Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: UpperCase function on parameter field Post Reply Post New Topic
Author Message
teddybear
Newbie
Newbie


Joined: 27 Aug 2007
Online Status: Offline
Posts: 6
Quote teddybear Replybullet Topic: UpperCase function on parameter field
    Posted: 06 Jan 2010 at 9:15pm

Hi there,

I have a static string parameter field with "Allow multiple values" set to True. My goal is to convert the user input on this parameter to upper case as the value store in the database are in uppercase.
 
I tried this in the Select Expert :
 
UpperCase({?parameter1}) and I got the following error message :
 
The array must be subscripted. For Example: Array.
 
I am on Crystsal Report XI. Can someone advise.
 
Thanks in Advance


Edited by teddybear - 06 Jan 2010 at 9:16pm
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 07 Jan 2010 at 8:28am
I know that on SQL data sources that string parameter comparisons are case-in< ="Content-" content="text/; charset=utf-8">< name="ProgId" content="Word.">< name="Generator" content="Microsoft Word 11">< name="Originator" content="Microsoft Word 11"><> sentitive.  So, you may not need to do any conversion.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 07 Jan 2010 at 9:32am
Actually, that depends on the type of database you're using and how it's configured.  Oracle IS case sensitive unless the DBA has set it to not be.
 
teddybear, can you post the whole formula from the Select Expert (not just this piece, but anything else you might have in there as well)?
 
Thanks!
 
-Dell
IP IP Logged
teddybear
Newbie
Newbie


Joined: 27 Aug 2007
Online Status: Offline
Posts: 6
Quote teddybear Replybullet Posted: 07 Jan 2010 at 5:56pm
Hi there,
 
Thanks for the reply.
 
This is the whole formula in the Select Expert
 
UpperCase({ITEM_CODE}) = UpperCase({?Element})
 
Where ITEM_Code is the datbase field and ?Element isthe parameter field.
 
I am on Oracle 9i
 
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 08 Jan 2010 at 7:00am
Did you just type this in?  Usually fields are in the format {table.fieldname} - I don't see the table name in your reference to the ITEM_CODE field.  Or is this just a typo in your post?
 
If it's just a typo in your post, try creating a formula that does the UpperCase({?Element}) and then using the formula in your Select Expert.
 
-Dell
IP IP Logged
teddybear
Newbie
Newbie


Joined: 27 Aug 2007
Online Status: Offline
Posts: 6
Quote teddybear Replybullet Posted: 10 Jan 2010 at 4:16pm
HI Dell,
 
You are right, the complete formula shouls be as follow :
 
UpperCase({ITEM.ITEM_CODE}) = UpperCase({?Element})
 
where ITEM is the table name.
 
Let me just add on this.
 
When I declare the parameter field as "Allow multiple values"= FALSE, I did not get the error message :The array must be subscripted. For Example: Array.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 11 Jan 2010 at 6:48am
That is correct, you cannot do an UpperCase on multiple values from a parameter this way.  If you're familiar with SQL, this makes sense - Crystal replaces parameters in the SQL it generates by using the actual value(s) entered for the parameter.  So, for example, when you enter a list of string values, you get something like this in the SQL (using Oracle syntax):
 
myTable.String_Field in ['Value1', 'Value2', 'Value3']
 
If you try to use UpperCase on the parameter, what Crystal will try to do is this:
 
myTable.String_Field in UpperCase(['Value1', 'Value2', 'Value3'])
 
This is invalid syntax for the database, you'd have to have something like this instead:
 
myTable.String_Field in [UpperCase('Value1'), UpperCase('Value2'), UpperCase('Value3')]
 
But, if you have just a single value, it works with no problems:
 
myTable.String_Field = UpperCase('Value1')
 
-Dell
IP IP Logged
teddybear
Newbie
Newbie


Joined: 27 Aug 2007
Online Status: Offline
Posts: 6
Quote teddybear Replybullet Posted: 11 Jan 2010 at 4:38pm

Hi Dell,

Thanks for the reply again. I do understand what you are trying to say.

In this case, do you have any suggestion on the work around ?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 11 Jan 2010 at 6:49pm
This question has been asked before and I've never found/seen a good answer to it.  I'm no longer working with Oracle, so I don't have access to documentation, but you may want to see if there's a way to turn case sensitivity off for a specific query For example, Set Define Off tells Oracle to not use ampersand to identify substitution parameters; I've used this when I ran insert statements that contained '&' in field values.  There may be something similar you can do for case sensitivity.  Or you may need to do an "Alter Session" command for this.  In any case, if something like this is available, you'll need to put the SQL for your report into a command as an annonymous PL/SQL block and use your Set or Alter Session command as the first line.
 
-Dell
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.