Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Lower function for a parameter Post Reply Post New Topic
Author Message
mythprod
Newbie
Newbie


Joined: 20 Jul 2009
Location: United States
Online Status: Offline
Posts: 4
Quote mythprod Replybullet Topic: Lower function for a parameter
     Posted: 20 Jul 2009 at 10:57am
I'm reading the following in my XI official guide (running 2008 if that matters) but am not sure how to add a lowercase function to a parameter:

"...it might be a good idea to put the LowerCase() function on the parameter as well."

My parameter is {?Files} and multiple values are allowed. The parameter is a dynamic parameter whose values are pulled from a table in my database. I'm assuming I need to loop through my parameters and convert them to lowercase beforereadingrecords but am getting my syntax wrong:

BeforeReadingRecords;

Local NumberVar i;

For i := 1 To Ubound({?Files}) Do
   (
        ({?Files}) := LowerCase({?Files});
      
   );

My Select expert has LowerCase({Table.File_Name}) = {?Files} but the problem is sometimes the contents of {?Files} contain a different case character than the {Table.File_Name}. Converting all of the parameters to lowercase as well as the table name would fix it for me I think.
- MythProd
(John David Hutton)
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Jul 2009 at 12:56pm

You can't loop through and change them to lower case prior to the report actually reading records.

Instead, I would change the formula in the select expert to
 
LowerCase({Table.File_Name}) = LowerCase({?Files})
 
-Dell
IP IP Logged
mythprod
Newbie
Newbie


Joined: 20 Jul 2009
Location: United States
Online Status: Offline
Posts: 4
Quote mythprod Replybullet Posted: 20 Jul 2009 at 12:59pm
Thanks for the response, Hilfy. What if ?Files is an array, how would that syntax differ? I get a "This array must be subscripted. For example: Array"

- MythProd
(John David Hutton)
IP IP Logged
mythprod
Newbie
Newbie


Joined: 20 Jul 2009
Location: United States
Online Status: Offline
Posts: 4
Quote mythprod Replybullet Posted: 20 Jul 2009 at 2:29pm
The issue is, ?Files is a parameter that accepts multiple items, which means it's an array. What I'm not sure of it how to change all selected ?Files in the parameter window a lowercase before the records start being compared to the database. I have LowerCase(table.File_Name) in the select expert and I'm sure that will work, but I'm not sure where to convert my array. It won't work in the parameter window since ?Files is multiple items, maybe a formula run at every different file returned that would assign to a variable and then force that to lowercase? I'm not sure when and how CR increments an array variable so I'm not sure when and where to assign that variable lowercase.

- MythProd
(John David Hutton)
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Jul 2009 at 8:15pm
Unfortunately, I haven't done a lot of work with arrays.  Brian, do you have any suggestions?
 
-Dell
IP IP Logged
mythprod
Newbie
Newbie


Joined: 20 Jul 2009
Location: United States
Online Status: Offline
Posts: 4
Quote mythprod Replybullet Posted: 21 Jul 2009 at 9:06am

Each one of my files are grouped in my report. What if I create a formula that grabs the lowercase of each parameter file and then compares that with the database? Again my syntax is wrong but I'm thinking something like this:

Shared StringVar array convertedParam;
Local NumberVar i;

For i := 1 To Ubound({?Files}) Do
   (
        Redim convertedParam;
        convertedParam := LowerCase({?Files});
        convertedParam;
      
   );
(my brackets aren't making it through this new post form, is there a code snippet I should be using to escape these characters?)

Currently I'm getting a "true" as a result of this so obviously I'm doing something wrong. But am I on the right track? Then I use the select expert to make sure any table files it pulls is compared with convertedParam instead of the actual ?files param. Obviously I could have to add a counter so i would increment at each new file group.
 
 
- MythProd
(John David Hutton)
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