IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Example of Select a Field/Select an operand/Enter value
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Platinum Member
Posted
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.
 
Posts: 132 | Location: Kansas | Registered: November 12, 2003Reply With QuoteEdit or Delete MessageReport This Post
Expert
Posted Hide Post
-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.
 
Posts: 2624 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteEdit or Delete MessageReport This Post
Platinum Member
Posted Hide Post
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
 
Posts: 132 | Location: Kansas | Registered: November 12, 2003Reply With QuoteEdit or Delete MessageReport This Post
Platinum Member
Posted Hide Post
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
 
Posts: 132 | Location: Kansas | Registered: November 12, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
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.
 
Posts: 7 | Location: London, England | Registered: February 16, 2005Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    Example of Select a Field/Select an operand/Enter value

Copyright © 1996-2008 Information Builders, leaders in enterprise business intelligence.