Hi,
I'm using CRV11.
I'm going to create a report with about 5 fields.
PERSONID COUNTRY REGION PRODUCTS FUNCTIONS
1 USA Americas 1,2,3 A,B,C
2 Canada Americas 1,4,5 F,L,P
3 Mexico Americas 3,5,7 X,Y,Z
Multiple PRODUCTS per PERSONID and multiple FUNCTIONS per PERSONID is possible. And its unknown how many PRODUCTS or FUNCTIONS will exist per PERSONID.
Because of that I will be doing something like the following for the PRODUCTS field and for the FUNCTION field to get a unique row per PERSONID with all PRODUCTS and FUNCTIONS. Example here is for PRODUCTS only...
1)
I will group by ID.
2)
In the group header I will place the following formula code and suppress it.
CODE
WhilePrintingRecords;
global stringvar Products := "";
3)
In the detail section I will place the following formula and suppress it.
CODE
WhilePrintingRecords;
global stringvar Products;
Products := Products + {table.products};
4)
In the group footer section I will place the following formula to display the results
CODE
WhilePrintingRecords;
global stringvar Products;
Products
The issue I have is that this report will also have two prompts. One will allow a user to multiselect a number of PRODUCTS and another allowing them to multiselect a number of FUNCTIONS. These prompt selections need to be used in conjunction with the Record Selection Expert in order to limit down what rows should be part of the output. Just consider PRODUCTS...
If a user selects from a multiselect prompt dropdown 1 and 7 then I want the first and third rows from my sample data above (rows for PERSONID 1 and PERSON ID 3).
I'm not sure how to do this using the Report Select Expert. I see that I can setup things like:
if table.products "is equal to" <my prompt field>
if table.products "is one of" <CANT SELECT my prompt field>
Since none of whats available meets my needs I can go to the Formual Editor and build my own condition. If I do that and knowing that I may have multiple prompt select values that I want to compare to possibly multiple PRODUCTS values what is the best and most efficient way to do this in a Record Select custom formula?
With arrays... Load the prompt value into an array and load the PRODUCTS values into an array? Then loop through both checking to see if I get any matches. If I get a match get out of the loop and set a value like 1=1 at the end of the formula (to tell CR this record should be part of the output)?
Or is there another better way?
NOTE in the real report there could be up to about 50 PRODUCT(S) ids associated with a PERSONID. And when running the report the user could select something like 20 or 30 or more PRODUCTS in the PRODUCTS multiselect prompt. Same for FUNCTIONS.
Any code/ideas/comments is appreciated.
Thanks in advance.
I'm using CRV11.
I'm going to create a report with about 5 fields.
PERSONID COUNTRY REGION PRODUCTS FUNCTIONS
1 USA Americas 1,2,3 A,B,C
2 Canada Americas 1,4,5 F,L,P
3 Mexico Americas 3,5,7 X,Y,Z
Multiple PRODUCTS per PERSONID and multiple FUNCTIONS per PERSONID is possible. And its unknown how many PRODUCTS or FUNCTIONS will exist per PERSONID.
Because of that I will be doing something like the following for the PRODUCTS field and for the FUNCTION field to get a unique row per PERSONID with all PRODUCTS and FUNCTIONS. Example here is for PRODUCTS only...
1)
I will group by ID.
2)
In the group header I will place the following formula code and suppress it.
CODE
WhilePrintingRecords;
global stringvar Products := "";
3)
In the detail section I will place the following formula and suppress it.
CODE
WhilePrintingRecords;
global stringvar Products;
Products := Products + {table.products};
4)
In the group footer section I will place the following formula to display the results
CODE
WhilePrintingRecords;
global stringvar Products;
Products
The issue I have is that this report will also have two prompts. One will allow a user to multiselect a number of PRODUCTS and another allowing them to multiselect a number of FUNCTIONS. These prompt selections need to be used in conjunction with the Record Selection Expert in order to limit down what rows should be part of the output. Just consider PRODUCTS...
If a user selects from a multiselect prompt dropdown 1 and 7 then I want the first and third rows from my sample data above (rows for PERSONID 1 and PERSON ID 3).
I'm not sure how to do this using the Report Select Expert. I see that I can setup things like:
if table.products "is equal to" <my prompt field>
if table.products "is one of" <CANT SELECT my prompt field>
Since none of whats available meets my needs I can go to the Formual Editor and build my own condition. If I do that and knowing that I may have multiple prompt select values that I want to compare to possibly multiple PRODUCTS values what is the best and most efficient way to do this in a Record Select custom formula?
With arrays... Load the prompt value into an array and load the PRODUCTS values into an array? Then loop through both checking to see if I get any matches. If I get a match get out of the loop and set a value like 1=1 at the end of the formula (to tell CR this record should be part of the output)?
Or is there another better way?
NOTE in the real report there could be up to about 50 PRODUCT(S) ids associated with a PERSONID. And when running the report the user could select something like 20 or 30 or more PRODUCTS in the PRODUCTS multiselect prompt. Same for FUNCTIONS.
Any code/ideas/comments is appreciated.
Thanks in advance.