Hello,
In a ASPR.Net 10.2 project I am using 2 different list pages for one table and I'd like to change the SQL "where" statement depending on which page is loaded. From the help file, to add to the where statement we use query.addWhere in the before table initialized. So I tried this:
But pageObject is not available in the "After table initialized" event. So I moved that code to the "List page:Before SQL query" event, but "query" is not available there. Kind of a catch 22.
Next, in the "List page:Before SQL query" event I tried this:
This worked. But when the user enters search criteria, the search doesn't work because the search's where statement is replaced by this code. So then I tried this:
What I found with this approach is that, if there is no search criteria, my additional where statement works. If there is a search criteria, the search works but it is not adding my additional criteria.
I would love to use the query.addWhere approach on the "After table initialized" event, since that is what it is meant for and it seems the cleanest, but I need to know which list page is loading, and it doesn't seem possible in that event.
Does anyone have ideas on how I can append an additional where clause depending on which list page is loaded?
Thanks,
Tim
In a ASPR.Net 10.2 project I am using 2 different list pages for one table and I'd like to change the SQL "where" statement depending on which page is loaded. From the help file, to add to the where statement we use query.addWhere in the before table initialized. So I tried this:
if( pageObject.pageName == "list_ReconcileTotals" ) { query.addWhere("Reviewed = 0 AND Received = 1"); }
But pageObject is not available in the "After table initialized" event. So I moved that code to the "List page:Before SQL query" event, but "query" is not available there. Kind of a catch 22.
Next, in the "List page:Before SQL query" event I tried this:
if( pageObject.pageName == "list_ReconcileTotals" ) { strWhereClause="Reviewed = 0 AND Received = 1"; }
This worked. But when the user enters search criteria, the search doesn't work because the search's where statement is replaced by this code. So then I tried this:
if( pageObject.pageName == "list_ReconcileTotals" ) { if (strWhereClause == "") { strWhereClause="Reviewed = 0 AND Received = 1"; } else { strWhereClause=strWhereClause + " AND Reviewed = 0 AND Received = 1"; } }
What I found with this approach is that, if there is no search criteria, my additional where statement works. If there is a search criteria, the search works but it is not adding my additional criteria.
I would love to use the query.addWhere approach on the "After table initialized" event, since that is what it is meant for and it seems the cleanest, but I need to know which list page is loading, and it doesn't seem possible in that event.
Does anyone have ideas on how I can append an additional where clause depending on which list page is loaded?
Thanks,
Tim