on 07-20-2009 1:24 PM
Hi All,
I have a string that I am creating that concatenates values separated by a "^". This is in my main report.
I linked the string to a subreport. When I display the string in the subreport, it shows up. When I try to split it, I get the following error message: "An array's dimension must be an integer between 1 and 1000."
Main Report (Group Footer):
whileprintingrecords;
stringvar arrquoteid;
arrquoteid:=arrquoteidtotext({Quote.quoteid})"^"
SubReport (Details):
WhileReadingRecords;
stringVar array arr;
numberVar i;
arr:=split({?Pm-@arrQuoteID},"^");
i:=i+1;
if i<= Count(arr) and arr<i><>"" then
tonumber(arr<i>)
else
0
What am I doing wrong to receive the above error message?
Thank you in advance.
In crystal reports an array can store only 1000 values. This is by design. I think this error is because you didn't mention the index value for an array. Try this
WhileReadingRecords;
stringVar array arr;
numberVar i;
arr:=split({?Pm-@arrQuoteID},"^");
i:=i+1;
if i<= Count(arr) and arr<i><>"" then
tonumber(arr<i>)
else
0
If you are still getting the error then try this
WhilePrintingRecords;
stringVar array arr;
numberVar i;
arr:=split({?Pm-@arrQuoteID},"^");
i:=i+1;
if i<= Count(arr) and arr<i><>"" then
tonumber(arr<i>)
else
0
Regards,
Raghavendra.G
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you have more than 1000 values then you need to try this
WhilePrintingRecords;
stringVar array arr;
numberVar i;
arr:=split({?Pm-@arrQuoteID},"^");
i:=i+1;
if i<= 1000 and arr<i><>"" then
tonumber(arr<i>)
else
0
If the above formula is working fine then you need to create 2 arrays based on the count of array values to accomodate more than 1000 values
Regards,
Raghavendra
Sure.
Main:
whileprintingrecords;
shared stringvar arrquoteid;
arrquoteid:=arrquoteidtotext({Quote.quoteid})"^"
Subreport:
WhilePrintingRecords;
stringvar array arr;
shared stringvar arrquoteid;
numberVar i;
arr:=split(arrquoteid,"^");
i:=i+1;
if i<= count(arr) and arr<i><>"" then
tonumber(arr<i>)
else
0
Did you place your sub report in the footer section after processing the formula? if so then try this in sub report
WhilePrintingRecords;
stringvar array arr;
shared stringvar arrquoteid;
numberVar i;
redim preserve arr[1000];
arr:=split(arrquoteid,"^");
i:=i+1;
if i<= 1000 and arr<i><>"" then
tonumber(arr<i>)
else
0
If you are still getting the error then try to place the following formula in sub report header and see whether you are able to see the values.
WhilePrintingRecords;
shared stringvar arrquoteid;
Regards,
Raghavendra
Your error is probably because, as you say, you have more than 1000 records. It doesnt matter if you check for 1000 after the fact, since the split function would have failed.
Here is one way to get around it.
1. In your subreport formula, get the count of the 999th ^ in the string arrquoteid. Then split arrquoteid from 1 to the count of the 999th ^ based on ^.
2. Then you can do this:
i:=i+1;
if i<= count(arr) and arr<>"" then
tonumber(arr)
else
0
Makes sense?
This is by design. See the following SAP Note
[https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313331333933383338%7D.do]
Regards,
Raghavendra
User | Count |
---|---|
72 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.