This topic is locked
[SOLVED]

pass variable on url to list page

10/2/2024 10:09:48 PM
PHPRunner General questions
A
asawyer13 authorDevClub member

I have a list page that has a button on the grid (list). When the user clicks on the button, I want to open another list page but only for the record id of the row on the list page that's clicked.

I am following example 8 Here
but don't know if there is a built in variable that the list page will use like editid1 in the example, or if I need to pass the value on the url with a variable name?

If I need to use a non built in variable name, I don't know how to get it in the list page to use it in the Where clause.

A
asawyer13 authorDevClub member 10/2/2024

I'm able to pass a variable to the list page I think, but having trouble in grabbing the value and using it

The url ends up being:
vwContainerSummary_list.php?val1=7460236

But not sure how to correctly grab val1 value in the list page. I know how to add it to the sql where clause if I can get the value.

Davor GeciDevClub member 10/3/2024

Not sure if this is what you are asking.

If you want to open another window with a filtered list.
For example I have a "employees_list.php" list page and want to open it with fitered value that only shows employee_id = 4444

If you take a look how the advanced filrer is bulding the correct url, then we need to construct the url for my example to look like this:

employees_list.php?q=%28employee_id~equals~4444

M
MikeUk 10/3/2024

What you could do, is get the button to set a $_SESSION['myRecordId'];
Then call the popup in the afterevent section of the button.

In the designer, make a copy of the list page and rename it - e.g. listsinglerecord.

In the before_SQL event of the list page add .

if ($pageObject -> pageName === 'listsinglerecord') {
$strWhereClause = " idFIeld = ". $_SESSION['myRecordId'] . "; ";
}

The call your redirct or set the popup url to the new list page

Admin 10/3/2024

To read a variable from the URL you can use $_GET["variable_name"]

A
asawyer13 authorDevClub member 10/3/2024

I thought I would try Davor's solution first.

http://localhost:8086/vwContainerSummary_list.php?q=%28parentContentsID~equals~7532550

Just gives me all the data in my lvwContainerSummary list page.

What am I doing wrong?

Alan

A
asawyer13 authorDevClub member 10/3/2024

I got it working.
Thanks everyone