This topic is locked

Default Where statement on 1st view

10/17/2008 9:57:47 AM
PHPRunner General questions
hfg author

I have no idea if this is even possible, but here it goes.
In some ways this idea is similar to the check box, "No records on the first page"
Would it be possible to write a Where statement that impacts a list when it is 1st openned, but if the user clicks "Show All" or searches no longer impacts the list until the next time they click on a link to it?
For Example, lets say I have sales data in a list.
The 1st time the user clicks on the list it shows only the current months data (by say Sales Date)
But if the user searches or clicks "Show All", all data is displayed (or the search results for a search).
My best guess is this this is even possible it would be through events, but I really have no idea. I'm just trying to keep the number of Options down to avoid overwhelming the users.
Thanks

T
thesofa 10/19/2008

If you set the SQL query to show only those records that you want to be shown on the first visit to a page, then you achieve the first part of the problem.

I had to do a similar thing witha report i had to do and i used the beforequeryreport event to modify the sql string.

But you want this on the list page.

The easy cheat is to do 2 builds of the same table, one with the sql sting to show the current data (current) and one to show the complete dataset (all), then just change the links in the files produced to take you from current_list.php to all_list.php after you press Show All.

Trying it on a test build will help you see what to do, it seems you will need to alter some Javascript

&nbsp; <SPAN class=buttonborder><INPUT class=button onclick="java script: document.forms.frmSearch.a.value = 'showall'; document.forms.frmSearch.submit();" type=button value="Show all"></SPAN>&nbsp;


That is the code from Visual Editor applying to the button.
You could try experimenting with replacing that code with a normal

<A class=tablelinks href="all_list.php"></A>



tag, see if that works.

Use a custom view to show the data for the first page and work from the table directly for the `all` page.

hfg author 10/20/2008

Thanks sofa
Two views was already the way I end up going. But the altering of buttons didn't occur to me thanks for the idea. It still makes the overall project bigger, but will keep it simple for my users.
Idea for future release - a copy function for View and Reports that copies the entire setup of a view or report. This could really same me some time.