Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Formula to count multiple values from a parameter? Post Reply Post New Topic
Author Message
eyost
Newbie
Newbie


Joined: 08 Oct 2012
Location: United States
Online Status: Offline
Posts: 2
Quote eyost Replybullet Topic: Formula to count multiple values from a parameter?
     Posted: 22 Mar 2015 at 11:46am
Hi all,

I have received a request that based upon the values entered in a parameter that can accept multiple values the column label will change. For example, if all of the values that have been selected for the parameter contain the word 'Refinance', the column label should change, otherwise it will not. I have already figured that I can use Upper Bound to determine the number of values entered in the parameter, but I am unable to figure how to do the count for the values entered in the parameter that match my criteria. Figure a loop would be needed that would say something like If instring parameter 'Refinance' then i = 1, then i = i + 1, but I am not sure of the syntax?

The thought is when the loop is finished I would compare the count for that one against the total number of values entered and if they are the same then the column label would be changed.

Any ideas on how best to do this would greatly be appreciated.

Thanks,

Ed
IP IP Logged
eyost
Newbie
Newbie


Joined: 08 Oct 2012
Location: United States
Online Status: Offline
Posts: 2
Quote eyost Replybullet Posted: 23 Mar 2015 at 5:23am
Figured it out for those that may run into a similar issue.

Local NumberVar i := 1;
Local NumberVar rc := 0; //refi count
Local NumberVar nrc := 0; // non refi count
    For i := 1 To UBound({?ProductTypeMove}) Do
    (
        IF {?ProductTypeMove} LIKE '*Refi*'
        THEN
            rc:= rc + 1
        ELSE
            nrc:= nrc + 1
    );
IF nrc > 0  OR {?ProductTypeMove} = '%'
THEN
FALSE
ELSE TRUE;
 
 
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum