Filtering pages using queries and URL parameters and Anchor Buttons

I have read the document on how to do this “Filtering Database Query with an URL Parameter” and this is working fine.

I have a number of anchor buttons to select which URL parameter should be used. Currently I am using a different Dynamic Event and a on click action for each button to

Hello @ellisdav
What is the issue with the buttons?

Sorry my draft question got sent too early.

Each of the Anchor Buttons uses a different Dynamic Event to call the same page using browser.goto but now with the URL parameter set.

This works OK but I thought there might be a simpler way of doing this.

What are you trying to achieve exactly?

I have query returning various records. One of the fields returned is called “area” which is to be used for filtering the records that are returned.

The calling page is called bulletin.php and I use the anchor buttons to do a browser.goto to each of the URL parameters wanted bulletin.php?area=1, bulletin.php?area=2 etc.

This is working fine but I thought there might be a smarter way of doing this.

Is using an url variable mandatory in your case?

I am asking, because the way you are using this with browser.goto is not quite optimal, not to mention you reload the page every time the button is clicked. With Wappler you can filter your data on the fly, without doing page reloads …

Yes I was looking for a more optimal way of achieving this result.

The Area field can contain four numeric values 0, 1, 2 or 3 - I would like the user to be able to filter using a friendly selection method (possibly a button )

There are several ways to achieve this.
If an URL param is not needed:

  1. Create a variable in App Connect … let’s call it var_filter
  2. Pick the variable value as a value for the parameter you use to filter the database query in the server connect component on the page.
  3. Select your button, add new dynamic event > click > Variable > Set Value … and enter your value.

If an URL Param is needed:

  1. Add Query Management component in App Connect
  2. Select your button, add new dynamic event > click > Query Manager > Set … select your query parameter and enter the value you need
    This way your page won’t be reloaded when the url param value changes.

Hope that helps :slight_smile:

I’m REALLY confused by something.

In MY case, I have a small dataset. 1000 recs. Basic registration info (name/addr/etc.) PLUS a few fields to filter by (f1, f2, f3)

I read the 2018 docs, Filtering Database Query with a Text Input. That modifies the QUERY to include the search text. I did this and it worked fine. And I believe its hitting the db each time you type a letter.

THEN I read your answer above and you said “This way your page won’t be reloaded when the url param value changes” because earlier you said “With Wappler you can filter your data on the fly”. In this post, you didn’t mention anywhere about modifying the QUERY to filter at the db., so I’m assuming the framework is filtering this on the client.

Whats hard for me to know is what best practice for today?
Maybe in 2018 you didn’t do this filtering you speak of in 2020?
Maybe now in 2022 something else has changed.

Since I have a relatively small dataset, I’m wondering if its not a bad thing to do the filtering in the client as @ellisdav was writing about, so I tried this with the “anchor buttons” and couldn’t make it work.
It appears for either of your methods that I DO NOT need to modify the Query (cause I’d want all records) and local filtering is occurring.

I’m back to trying “If an URL param is not needed” and I get all data from the query, but nothing happens when I click any of my buttons (the variable gets set, but the data doesn’t change).

And the bad thing is that I really want to user some Anchor buttons AND the search-text field, and have no clue which way to go.

I’m just trying to QUICKLY learn to get some results but I can’t seem to find the correct docs and as you see I’m questioning if what I’m reading is still valid. (example: I don’t even see an “App Connect”, only Server Connect.)

It seems really hard for a new user to grasp this tool because of outdated docs and renamed functionality.

That’s an old topic indeed.
Can you tell me what do you need to achieve on your page, so i can point to the correct tutorial?

I had been using pages like


and then


so i kinda need all that to start with.
hosting on a DO droplet,
getting data from my MSSQL server

I got a simple data list and masonry image page working.
then needed to start filtering based on some criteria (user entered text, and buttons for a predefined filter)

nothing too fancy, i’m just starting out.
but i’m experienced IT and other tools.
logically, next steps are drill down to a form page from the list,
update and save data. normal progression.

Functionality identical to the top search/filter bar at pukkatravels works fine for my needs. I see they are using querystrings/URL parms.

and while i’m thinking about it,
am i correct with ‘client side filtering’ like i think I read?
Does this exist?
for <1000 recs, is this ok to do on desktop AND mobile?

or do I want to hit the DB each time?

And the next Q w.r.t. URL parms is going to be 'how to handle null/empty querystrings?"
I didn’t see this covered in the docs page on URL parms.

Usually in a SQL statement, I know how to handle that, but not in Wappler yet.

ALSO, I’m wondering what Pukka’s database query consists of on the Conditions tab. Are any of these filtering choices IN the query? Or are they only handled using a Query Manager on the page?

So you want to filter your database results using form inputs? Or do you want to use URL parameters?
Sorry it’s really not clear to me what are you trying to achieve, as you are jumping from topic to topic.

If you want to filter your database query using form inputs, that’s the way to do it:

If you want to use URL parameters then that’s the way:

Nothing has changed in the logic of doing these things except for some UI colors/icons.