How to Set Conditional Filtering on Dynamic Pages' Dataset?

Hello Coders.

As the title suggest, I want to filter a dynamic page’s dataset with code, not with the UI filter, even though it’s very useful and handy in basic situations, there’s some places that you gonna need an advance filtering to achieve your goals.

I want to filter the dataset conditionally, that means I can’t set a filter inside the dataset using the UI. The dynamic page is a page that customers edit their (refunds/returns) requests on, but they can’t edit their requests whenever they want, their request must be in “Waiting” state, or if their request was rejected and they decide to appeal, here’s what my code looks like:

$w.onReady(async function () {
    await $w('#returnItemDataset').onReady(() => {
        let itemObj = $w('#returnItemDataset').getCurrentItem();
        
        let requestStatus = itemObj.requestStatus; // Text
        let appealed = itemObj.appealed; // Boolean
        let appealRejected = itemObj.appealRejected; // Boolean
        
        if (requestStatus === 'Rejected' && appealed === true && (appealRejected === false || appealRejected === undefined)) {
            $w('#returnItemDataset').setFilter(wixData.filter()
                .eq('requestStatus', 'Rejected')
                .eq('appealed', true)
                .eq('appealRejected', false) // <<== Here

            ).or(wixData.filter()
         } else if (requestStatus === 'Waiting') {
              $w('#returnItemDataset').setFilter(wixData.filter()
                  .eq('requestStatus', 'Waiting')
              )
         } else {
             wixLocation.to('/403');
             console.log("User doesn't has permission to view the page");
         }
    }
}

But I don’t want to to only filter the “appealRejected” value if it was false, I wan’t filter that value if it was false OR undefined. This is crucial since new submitted entries have their Booleans undefined by defaults, and filtering only if the value is false means that new customers won’t be able to edit their requests unless I opened the database and checked the “appealRejected” box (clears the undefined value and set it to true) and un-check it again (set the value to false manually).

is there a way around it? Since using .or returns a syntax error, and I can’t find any useful documentation on it’s page on how to use it in filter.

Here is its documentation page here.
And here is the WixDataQuery’s .or documentation.

They’re exactly identical, don’t know why!

Any ideas? Help will be much appreciated.

Can I just use the regular ( | | ) command?

.eq('appealRejected', false || 'appealRejected', undefined)

It doesn’t show any syntax error at all, but that doesn’t mean that it’s right, or does it?