Focal Point
Example of Select a Field/Select an operand/Enter value

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5661038331

February 25, 2005, 05:46 PM
webfocuspgm
Example of Select a Field/Select an operand/Enter value
Can anyone offer code or suggestions on how to create a report that allows the user to Select a field, Select an operand and then enter a value that will then be used as a WHERE selection inside the report.

Filter 1 - Drop-down could contain Car, Country, Model, Body

Select an operand - EQ, GT, GE, LT, LE, LIKE

Enter value - If user selects Car from Filter 1 this could contain JAGUAR, Country it could contain Japan.


I've worked a little with amper variables but I don't know how to put them into a Where - and maybe that isn't how this needs to be done... at this point I'm not sure what to do ......

Any and all help is always appreciated.
February 25, 2005, 06:14 PM
susannah
-DEFAULT &MYFLD = 'CAR' ;
-DEFAULT &MYREL = 'EQ' ;
-DEFAULT &MYVAL = 'JAGUAR';
-SET &MYFILTER = 'WHERE ' | &MYFLD | ' ' | &MYREL | ' ' | &MYVAL ;

TABLE FILE CAR
..do stuff
&MYFILTER.EVAL
END
..the eval may not be necessary. it isn't in my site, but might be in yours.
But the trick is gonna be in your launch page.
Java Script arrays...if your use picks 'CAR', then the 3rd dd list should switch to a car list
and the 2nd dd list should switch to just 'EQ'.
That's the fun part.
February 25, 2005, 06:25 PM
webfocuspgm
Thanks susannah.... I was just going to force them to put something in because I don't know how to populate the box based upon the filter either. I know there is a "chaining" option. This is definitely a learn as I go project..... I wish we had another reference on Focal Point for code examples. There is so much you can do if you just know it's out there ...... and I stand in awe of those of you who are more experienced and code java inside your fexes - I can barely get my basic reports out.....

Thanks again
February 28, 2005, 06:11 PM
webfocuspgm
I have susannah's example working but now I'd like to fix the filter1 to work like an ampervariable field..... - is this possible..? or should I just hard code the field names in my Resource Layout...?

Thanks
March 01, 2005, 07:15 AM
VORob
I asked a very similar question about a week ago and receieved a couple of useful answers which almost, but not quite, fixed the problem.

In the end though I used a data driven solution to this problem. For the purposes of populating the list boxes on my report launch page I created one table which combined all the data from the various lookup tables that the user could potentially select. The table simply contains two columns, the first identifies the category that the user could select - CAR or MODEL etc - the second column gives the corresponding data value. So, for example, if your CAR table had 5 records and the MODEL table had 20 records this new table would contain 25 records. Make sense ?

I then add two chained list boxes to the launch page, the first using column 1 as it's data source the second using column 2 as it's data source. Because the list boxes are chained together as the user selects a value from the first list box the values in the second will be filtered accordingly.

This only gives you references to supply to your parameterised report - obviously then you refer back to the original lookup tables.

Possibly not the smartest solution in the world but this problem frustrated me for ages and this was the only fix I could get to work.