This topic is locked

Custom WHERE query for export

9/22/2015 6:46:43 AM
PHPRunner General questions
C
christou author

I have a table with a DATE column,

the user would like to export data only for a specific month (say, showing record of only January 2015) or specific week (25th week of year 2014)
First question:

with this situation, what is the best way to do so?

User would like to have the specific data in Excel format.

I don't mind the user to filter the result in the Advance Search page.

But the date-range function seems not working in my build (PHPR 8.1)
---

I have build a simple page with HTML and form to ease the user when inquiring. The form use GET method.

I also use the $query->addWhere function to alternate the WHERE clause using $_GET

However, none of my custom GET values passes to the final export page.
Second Question:

No only limited to this situation, I have many features that need to modify the WHERE clause on-the-fly by passing $_GET value. Is there any solution to this?

Sergey Kornilov admin 9/22/2015

Date range search should work and this is the most reliable and correct option. If for some reason it doesn't post your project to Demo Account and contact support directly.

C
christou author 9/25/2015



Date range search should work and this is the most reliable and correct option. If for some reason it doesn't post your project to Demo Account and contact support directly.


Thanks!

Just realized that the data type should set to Date/Time in order to use the Between option (I use my own date time picker before)
regarding the second question, any solution?

I may have other complex criteria that is not available in advance search option (for example: list data only for government holiday)

Sergey Kornilov admin 9/25/2015

If you are looking for something totally custom you can add your own WHERE clause using AfterTableInit event:

http://xlinesoft.com/phprunner/docs/modify_sql_query_on_the_fly.htm

C
christou author 9/26/2015



If you are looking for something totally custom you can add your own WHERE clause using AfterTableInit event:

http://xlinesoft.com/phprunner/docs/modify_sql_query_on_the_fly.htm


Yes, but how if I have some dynamic data feed by $_GET?

for example, I have my own HTML form and I'll let the user to input custom search criteria and pass those user input value by $_GET.
for now, I fount that some JS in the pagination and export script didn't pass-through my $_GET values

Sergey Kornilov admin 9/27/2015

On that page where you pass some data via $_GET save those parameters in session variables i.e.

$_SESSION["somevar"]=$_GET["somevar"];


You can then use this session variable in any event.