Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Array as a subreport link

Status
Not open for further replies.

JarreZoolook

Technical User
Sep 4, 2007
9
0
0
DK
Hi,

Crystal Report XI
MSSQL database

When I use a array as a subreport link I get an error in the formula so I wonder if this function is changed in CR XI because I think I have done as all the posts and other sites says it should be done.

In subreport A I create a array of type number.

In my main report I join this array before using it as a subreport link:
WhilePrintingRecords;
shared stringvar array StamdataArray;
Join(StamdataArray,",")

Then I pass the formula to subreport B and in this subreport I want to use this array in the Select Expert. In the Select Expert I enter this formular:
{QV_PROC_PROPS_SHORT_STRING.OBJECTID} in tonumber(split({?Pm-@Risikovurdering - Stamdata Key}, ","))

But this formula gives this error:
This array must be subscripted. For example: Array.

I have see the formula described many places (for example here: but maybe this is for a older version of Crystal Reports.

I hope that anyone can tell me what I am doing wrong.

Morten
Denmark
 
The problem is the ToNumber around the Split. Split creates an array and you can't apply ToNumber to an array, only to a single value. What you can do is use ToText on the Object ID (formatting it the same) and compare that to the String array. Or you could write a loop to compare to each element of the array.

Note that these options will probably process slowly because the data type conversion may not make into the SQL WHERE clause.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top