aragorn
Posts: 2
|
| Posted: 08/22/2006, 8:54 AM |
|
Hello, I posted this same topic under the ASP forum over 2 months ago and never received any response. Hopefully this forum is better. I've searched every where for help on this. Actually, there may be an answer for this and I just don't know exactly what to search for. I'm a little familiar w/ vb & SQL. I'm using CCS 2.3.2.28, MS Access, & ASP w/ templates. What I'm trying to do is have the user enter an age in months w/ >, >=, <,or <= into a field on a search form to limit the amount of data that pulls up. Example: User input would be <=16. Result would be anything that has an age of 16 or less. I have the datasource setup as Age = {s_Age} right now, which will pull up anything that equals the Age. How can I have the user input the operand that would feed the datasource/SQL string? Can I create some custom code that would define a combination of an operand and an integer that would allow it to be entered in the search field? if so where would I place the code, in one of the events? The Age field is setup as an integer at the moment? Hopefully, Im asking/stating my problem correctly, since I'm not a programmer.
Any Help would be greatly appreciated
Victor
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 08/22/2006, 12:55 PM |
|
assuming that you already have the code in place that can calculate the age, you will of course already be able to do your databases dialect of
SELECT * FROM table WHERE (today - birthdate) = {s_Age}
So in your search form you could have a listbox, the datasource of the listbox could be 1,'=',2,'<=',3,'>=' and what else you need.
The in BeforeExecuteSelect event of the grid you could simply test for the value of Listbox and put a modified select in there.
Not ASP but pseudo:
case $Component->ListBox1->GetValue()
of 1
$Component->ds->SQL = "SELECT * FROM table WHERE (today - birthdate) = {s_Age}";
break;
of 2
$Component->ds->SQL = "SELECT * FROM table WHERE (today - birthdate) <= {s_Age}";
break;
and so on.
W.
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
|