Action based upon query producing no records

I would love to have a feature added to Wappler where if my query produced no results i could fire the browser goto action.

In other words sometimes when working with say a URL Parameter to show certain content the user might click a link that was emailed to them that no longer exists a few days later, such as an order or to show the items in their shopping cart.
If my system auto removed unprocessed shopping cart content after 30 days lets say, and the user clicked that link after the link had expired I would rather not show an empty shopping cart but redirect them to another page.

On a query we already have dmx-on:invalid and dmx-on:error, so could we add dmx-on:notHasItems=“browser1.goto(‘index.php’)”

PLEEEESE.

Hello Paul,
Why just not show a section with a notification when no records are returned and put a “go back” button there?

Hey Teodor, yeah that is exactly what I have currently done.
Currently if the user had to go to my url parameter page and if it had records i am using a
dmx-show:"serverconnect1.data.query1.hasItems()" which then shows them all their items in their cart and then a
dmx-show:"serverconnect1.data.query1.hasItems()" which shows them a message of "Your items expired, please go back to the shopping page if you would like to order something else <a href="https://www.example.com/go-shopping/">GO SHOPPING</a>

But i figured I might add another page that possibly shows all the expired products at their updated prices rather for a quick reorder, however i would like to then redirect the user to that page when opening their shopping cart right away. Not a terrible train smash if i can’t was just thinking it would be a really handy feature to have.

Hi Paul,

This is indeed the way to go - you should think more of the visual “states” of your application and the display regions.

So you will have a state regions for “Items being loaded”, “No items found”, “Items list” and even maybe “Error during items fetch”

So think more in terms of visual representation to the user then just your data.

1 Like

hmmm, giving me something to think about here @George let me have a beer while i ponder this…

1 Like

we were actually thinking also to provide ways in Wappler to “emulate” those states. So you can easily check in design view how the loading, no items, a lot items or error state looks like and design accordingly … :slight_smile:

1 Like

@George @Teodor @patrick @boris
So I am only half way into this beer and have come to the conclusion that you guys must me insanely clever, honestly my head feels like it is about to explode with just thinking about a blooming shopping cart, I have spent 4 nights pretty much dreaming about all the plan of action to make this work well.
I have about 40 pieces of paper full of flow diagrams and arrows pointing to different tables.

I can not even imagine how you guys must be feeling after designing the application that can design the simple shopping cart.

Well Done guys :clap::clap::clap:

3 Likes