Query Parameter From Modal Data

I’m sure I’ve missed something here, but I have a SELECT query which I’m attempting to constrain using a parameter. The parameter appears to pass through correctly, but the query returns all records, not records only containing the company_id I’m using as the parameter.

Query:
image

App Server Connect Properties:
image

Full Input Parameter: modal_company.modal_company_data.data.id

Request URL:http://localhost/dmxConnect/api/crm/read_touches.php?company_id=1

Browser Results:
image

So it looks to me like company_id=1 is being passed through in the request, but the query is returning results containing company_id=6

Can anyone see what I’ve done wrong?

In the above Browser Results both results have the company_id of 6… The ID’s of the records are fine and both unique. Maybe change the company_id to a unique id… Or use the id of the records as the filter parameter? :slight_smile:

Right, but I expect the results to return empty, because I’m trying to pass through company_id = 1.

Have you added the query parameter company_id to the app on the page itself? Click on App then on Define Query Params and add it there…

And be sure to select this Query Parameter as your filter for the Server Connect get variable in your ‘result’ page Server Connect Action Input Parameter.

Ah, no I haven’t done that. But now I’m also wondering if this was the right way to do this vs the normal filter method which doesn’t require a query parameter?

You could set a cookie on click and filter by the cookie which is the way we like to do it, using a decent unique string as a UID rather than numeric sequential id’s which are easy to manipulate. I’m sure the page Query Params had something to do with it the last time we went this route though, via GET.

Cookie route is simple!

Add the Cookie Manager to your page. Define the cookie company_id in the cookie manager. Set this on click of the mouse in Dynamic Events picker.

In the Server Action add the cookie company_id under globals (keep your cookie names all lower case), select your company_id ‘equal’ select your cookie from under globals. Nice and easy! But this is not what you set out to achieve! Try the Query Params first and if that doesn’t work maybe consider the good old cookie route :slight_smile: