CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Filtering

Print topic Send  topic

Author Message
mavtech

Posts: 133
Posted: 10/19/2004, 10:46 AM

I am using this to filter dates in a radiobutton list.

In before show row

$Products1->dates->ds->Where = " dates.product_id=" .
$Products1->Products_ID->GetValue();
$Products1->dates->Prepare();

I really don't understand how it works but it seems to add the where clause to the statement and filter the list to only include dates associated with a product. So it works great.

Now I want to also filter out dates previous to today.

I can filter them at the radiobox level after a certain date but I want it to be after current date. When I do this I get two where commands one from above and anther from this.

2 questions.
1. How do I compare to todays date.?
2. How can I edit the above to filter out old dates.

Paul

View profile  Send private message
peterr


Posts: 5971
Posted: 10/19/2004, 11:46 AM

I'm also not sure how the above works, but I would do the same without coding - by specifying the SQL or Where statement in the "Data Source" property of the radio button.
Then you can just write the full Where statement that you like to use.

As for comparing to today's date, it may depend on the database that you use. I recommend that you refer to your database documentation and find date functions. They should also have some examples of using them.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
mavtech

Posts: 133
Posted: 10/19/2004, 12:00 PM

Could you explain in more detail how you would do the above without coding ?????

Paul
View profile  Send private message
peterr


Posts: 5971
Posted: 10/19/2004, 12:18 PM

I would click on the [...] button in the Data Source property, then create Where parameters that I may need, or create the whole SQL statement.
If you worked with Grids, you may be familiar with the Data Source. If not, take a look at http://docs.codecharge.com/studio/html/UserGuide/Forms/FormDataSource.html

Though actually I cannot gurantee that this method would work in every case. I would have to be working on some project and try to implement and test this functionality. It was just an idea that would require some "play time".
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
mavtech

Posts: 133
Posted: 10/19/2004, 1:54 PM

Only issue I see is that the filter changes for every row.

Such as

Course 1 jan 1, jan 2
Course 2 feb 1, march 2

Can I do that kind of filter at that level.

Paul
View profile  Send private message
peterr


Posts: 5971
Posted: 10/19/2004, 1:59 PM

I see. Then your code approach may indeed be necessary.
I don't work too much with PHP but I imagine that you could try:
$Products1->dates->ds->Where = " dates.product_id=" . $Products1->Products_ID->GetValue() . " AND dates.date=(some SQL date function)";
or
$Products1->dates->ds->Where = " dates.product_id=" . $Products1->Products_ID->GetValue() . " AND dates.date=" . (some PHP date function);

_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
mavtech

Posts: 133
Posted: 12/13/2004, 9:00 AM

Thank you. Now I want to only seach fo the the first 6 dates I filter this later on using LIMIT 6 but at this point it creates the list of 100 dates and it takes along time. I would like in the prepare statement to limit it to 6.

Can you help.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.