Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Array Must be Subscripted Error Post Reply Post New Topic
Author Message
rcoxe
Newbie
Newbie


Joined: 19 Apr 2018
Location: United States
Online Status: Offline
Posts: 10
Quote rcoxe Replybullet Topic: Array Must be Subscripted Error
    Posted: 14 Oct 2020 at 4:49am
I have a parameter to allow the user to enter which warehouse they want to use for the report. I also have a formula to display the warehouse specified, or, if none is specified, then return "All". I am trying to make this parameter accept multiple values but when I do this, I get an error in my formula:

"This array must be subscripted. For example: Array "

I have changed my formula to show one of the values but cannot figure out how to get it to display all of the values.

Currently my formula is:

"IF(NOT(HasValue({?Warehouse@SELECT WhsCode FROM OWHS}))) THEN "All" ELSE {?Warehouse@SELECT WhsCode FROM OWHS}[1]"

How can I modify this formula to show all values entered in the parameter?

Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 20 Oct 2020 at 5:34am
I am guessing that the parameter is from the Crystal Report parameter screen.

To return all the selected options, I usually use:
local numbervar j;
local stringvar selected:="";

for j:= 1 to ubound({?parameter})
   selected := selected + ", " + {?parameter}[j];

selected



since the parameters are an array, you could also use:
join({?parameter}, ",")

HTH
IP IP Logged
rcoxe
Newbie
Newbie


Joined: 19 Apr 2018
Location: United States
Online Status: Offline
Posts: 10
Quote rcoxe Replybullet Posted: 21 Oct 2020 at 8:55am
That did it. Thanks lockwelle.
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.063 seconds.