Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Adding prefix to a parameter value Post Reply Post New Topic
Author Message
SATELE01
Newbie
Newbie
Avatar

Joined: 13 Aug 2012
Location: United States
Online Status: Offline
Posts: 24
Quote SATELE01 Replybullet Topic: Adding prefix to a parameter value
    Posted: 13 Nov 2012 at 9:12am

HI

 
I HAVE THE FOLLOWING FORMULA
 
{dt_Employee_Payroll_Detail.Client_ID} = ToNumber("10"+{?Client ID})
 
AM TRYING TO ADD "10" TO THE VALUE ENTERED AS THE PARAMETER AND KEEP GETTING ERROR MESSAGE
 
Array must be subscripted. This only errors when the multiple value is "true"in the parameter. When "false" process works fine
 
 
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 13 Nov 2012 at 11:31am
if there are multiple allowed, then CR treats the parameter as an array, and so the statement to add "10" to the array makes no sense.
 
you would need to iterate through the array and add the 10 for each element if you want to both add the 10 and have multiple values.
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 13 Nov 2012 at 10:47pm
Hi
 
Try this :
 
Local StringVar str := "";
Local NumberVar i;
For i := 1 To count ({?name}) Do
(
str:=str+"10"&{?name};
i=i+1;
);
str
 
Note : you may have to modify this formula according to your data types.
Thanks,
Sastry
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 14 Nov 2012 at 6:22am
I would think that what you really want is:
 
local numbervar x;
for x := 1 to ubound({?parameter}) step 1 do(
  {?parameter}[x] := "10" + {?parameter};
)
 
 
I am using x, only because bracket i bracket makes italics. In addition, SATELE01, wanted how to alter the parameter, though making a string would be a helpful check. 
 
hopefully, I got all the syntax correct
 
 
 
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.031 seconds.