Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record Selection Formula Editor

Status
Not open for further replies.

dnguyen

Programmer
Apr 16, 2001
11
AU
Hi All,

I have a problem, we have built a Lotus Notes app. which uses CR for reporting. A form has been built and there are around 10 options for the user to select, in filtering out the data.

The problem here is, I have also created these 10 options as parameters in CR, and based on these options I would write a IF-THEN-ELSE code for the "Record Selection Formula Editor".

But, this would mean putting together an extreme large block of code, say 10 to the power 10 of IF-THEN-ELSE, and this is not very effecient.

Is it possible to pass a string value to the RSFE (Record Selection Formula Editor), rather than hard coding the data fields to retrieve.

ie. instead of if {?Brand <> &quot;&quot;} then {Adhoc.Name<String>} = {?Name}, rather I would like to assign a parameter, say {?Selection} = &quot;{Adhoc.Name<String>} = {?Name} and pass this into the RSFE.

Is this possible or are there other ways in resolving the matter.

Thanks.
 
You can pass a single string to the RSFE. That string would have to be the entire formula.

However, I don't think you are doing the If-Then efficiently if you are having to do 10x10 to get 10 options. That would only be needed if every rule was dependent on the other 10 selections. Describe 3 of your 10 user selections and let me see if you are making more work than you need to.

Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Hi Ken,

For more info. we are serving CR through the WEB, hence using WCS, I have justed read you can use the option of SF for the Selection Formula and pass a single selection criteria to the RSFE, is it possible to pass more than one selection criteria to the SF?. If you do use this method, would it override what is also defined in the RSFE.

ie. HREF=&quot; + %3d + 'David' + ' and ' + {AdhocReport.State} + %3d + {NSW} &quot;>

Now, as to your question Ken, there are 3 options which are Mandatory, a &quot;Brand&quot; and two date fields, &quot;From&quot; and &quot;To&quot;, the other options they can select data on are &quot;Class&quot;, &quot;Client Name&quot;, &quot;Broker&quot;, &quot;Account&quot;, &quot;Code&quot; and so forth.

In the RSFE, its OK if they only select the mandatory fields, then the code would be {*} = {?Brand} and {*} >= {FromTo} and {*} <= {?To}.

But, if you have, lets say 3 other options available to the user to select, then the permutation of these 3 options would be 2 to the power of 3 = 8 IF-THEN-ELSE statements. What I do now about the RSFE, is that it returns data from tables based on your hard code but is there a way to code the RSFE so that it can retrieve data based on what the user inputs in certain parameters.

ie. at the prompts, the user inputs data in, &quot;Class&quot;, &quot;Account&quot; and &quot;Code&quot;, leaving the other options blank. Now, if I did code ALL of these IF-THEN-ELSE statements, then this is what it would look like,

IF {?Class} <> &quot;&quot; and {?Account} <> &quot;&quot; and {?Code} <> &quot;&quot; and ALL of the others = &quot;&quot; then
{AdhocReport.Class} = {?Class} and {AdhocReport.Account} = {?Account} and {AdhocReport.Code} = {?Code}

I know this is not the best way to code, but with limited knowledge in this app. this is the only way I can think off.

Any and all suggestions/advice would be much appreciated.

Cheers,
David.
 
How about 1 line per parameter:

If {?Class} = &quot;&quot; then True else {?Class} = {table.class} and
If {?Code} = &quot;&quot; then True else {?Code} = {table.code} and .....


You pass all 10 parameters to the formula, and it only uses the ones that aren't. True is an automatic pass for all records on that line.
Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top