Keep advanced search filter when navigating through records?

Hello, I have a Grid which has a Advanced search, when I set something in the advanced search it returns correctly the records in my grid.

On this grid, I can click on a record to open a Form where I can edit the selected record.
On this form I have navigation buttons to go from one record to the next/previous one.

How can I do it, that after you filter the records in the grid with the Advanced search, and then click on a record to open the Form, when you navigate to the next record, it will navigate on the next record based on the Advanced search filter??

Example:

Default Grid has 5 records: A1, B1, A2, B2, B3

I put in the advanced search a filter to show only records with “B”,

so now my grid has 3 records: B1, B2, B3

now I click on B1, and the form for this record opens.

If I press the “next” button, I will get the A2 record, which was the next one on the default grid, but I want to have B2 as the next record, based on the advanced search filter!

I don’t use forms in that way, but I believe that in the links settings in the grid you’ll find an option to maintain the where clause (or something like that) in the linked application.
Maybe it will have the effect you’re loooking for.

hello! first of all thank you for the answer!

I already enabled “Keep where clause” and that works, but it’s only for when the WHERE clause is declared in the SQL.
So if for my grid I use a WHERE clause and filter the records, then when I open my form it will navigate through the filtered results,

but as I said this is only if I put manually a where clause in the SQL, otherwise if I use the advanced search, that doesnt apply sadly!

One solution I already thought about, was to create in the Advanced search only custom fields, where I can create some kind of manual look up, and in OnScriptInit, use a CASE statement for that field and it’s results, and in the CASE statement use : sc_select_where(add) = " my where clause";

I’m pretty sure this would work because it adds a where clause to the sql, but the issue with this is, that some of my filters in the Advanced search have more than 100 options, and I can’t hard code that with a CASE statement…

According to a very old note I wrote for myself, onHeader this could be used to save the actual WHERE clause.



// saving the current where

[glo_app_where] = {sc_where_current};

// summary "filters" overides the current filter and are handeld differently

if (!empty($_POST["nmgp_parms_where"])) {

[glo_app_where] = str_replace("?#?","=",$_POST["nmgp_parms_where"]);

}

And then using the link setttings you could pass [glo_app_where] from the grid to the form app, where you can use it in its SQL settings.

Not sure it was really working then and even less sure if it would work now.