How to set a default value?

Not exactly then same question but related to query manager. Is it possible to set a default value to be used if no parameter appears in the URL (without hard coding it)? I have a page i want to default to a particular record if no URL parameter is sent.

You can use the “default” option available under data formatter options, and then assign a default value to be used.

You guys seem to think of everything, the trick is finding where to do it!
Sorry but where do I apply the data formatter options, would be really good it the default could be added via the Query parameters screen.
At present i have a database serverconnect and a bootstrap dynamic table based on a database query

It depends where you bind it - whenever you bind the data you see the data formatter icon - click it and assign the default value.

You can also set a default value the same way in the database query builder, where you bind the GET variable as a condition - will do the same job.

2 Likes

Thanks yet again @Teodor, setting at query builder level does exactly what i wanted. I would never have found that without your help. So much to learn, so little time to learn it!

2 Likes

Slightly related, but I can’t get It to work:
I want to use a Show when to show a div … only if URL parameter ‘navigation’==‘cms’ OR if URL parameter ‘navigation’ is not present or empty.
I added a Query manager, added a query ‘navigation’.
Then I selected the div and added Show when. Wappler added this to the div:
dmx-show=“query.navigatie==cms”
But it does not work.
Any suggestions?

Hello,
Your expression should be:

dmx-show=“!query.navigation || query.navigation == ‘cms’”

1 Like

Of course!
Thank you Teodor!

Hans

1 Like

When using Routing and /:paramater if nothing is supplied in the url the Route breaks. Can we apply a default value in this case? thanks

You can make your parameter optional by adding ? after it:

Screenshot_23

1 Like

I just saw it here Handling routes with empty parameters

thanks

Hey Teodor. Does this still exist? I can't find it anywhere.

Hi Rod, yes the default formatter is still there.