Focal Point
amp variable length problem?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5191098331

September 19, 2005, 01:59 PM
smkt591
amp variable length problem?
The amp variable, &CN_NBR_D, contains a list of customers separated by commas. If the list has about 8 or less customers, the code below executes just fine. Anything over 9 or 10 (it varys) results in a server error.


-IF &CN_NBR EQ 0 GOTO DEF05;
CNNBR/A2000 = 'Receiver(s): '|
'&CN_NBR_D';
-DEF05

I thought maybe it was a line length problem as we are running 4.3.6. However, even 8 customers is over 80 characters.
September 19, 2005, 03:00 PM
Tony A
I had a similar(ish) problem in 5.3.2 when I was trying to split
a variable length variable (
from 0 to over 400) into chunks of 54 chars to
display in a heading.
I eventually used the following -
[code]-SET &parmlen = IF &CN_NBR_D.LENGTH LT 54 THEN &CN_NBR_D.LENGTH ELSE 54;
-SET &Rep_Parms1 = SUBSTR(&CN_NBR_D.LENGTH,'&CN_NBR_D.EVAL',1
,&parmlen,54,'A54');

-SET &parmlen = IF &CN_NBR_D.LENGTH
LT 109 THEN &CN_NBR_D.LENGTH ELSE 109;

-SET &Rep_Parms2 = IF &CN_NBR_D.LENGTH GE 055 THEN SUBSTR(&CN_NBR_D.LENGTH,
'&CN_NBR_D.EVAL',55,&parmlen,54,'A54')
ELSE ''; -SET &parmlen = IF &CN_NBR_D.LENGTH LT 164 THEN &CN_NBR_D.LENGTH ELSE 164;

-SET &Rep_Parms3 = IF &CN_NBR_D.LENGTH GE 110 THEN SUBSTR(&CN_NBR_D.LENGTH,'&CN_NBR_D.EVAL',
110,&parmlen,54,'A54') ELSE '';
-SET &parmlen = IF &CN_NBR_D.LENGTH LT
219 THEN &CN_NBR_D.LENGTH ELSE 219;
-SET &Rep_Parms4 = IF &CN_NBR_D.LENGTH GE 165 THEN SUBSTR
(&CN_NBR_D.LENGTH,'&CN_NBR_D.EVAL',165,&parmlen,54,'A54') ELSE ''; -SET &parmlen = IF &CN_NBR_D.LENGTH LT 274 THEN &CN_NBR_D.LENGTH ELSE 274;


-SET &Rep_Parms5 = IF &CN_NBR_D.LENGTH GE 220 THEN SUBSTR
(&CN_NBR_D.LENGTH,'&CN_NBR_D.EVAL',220,&parmlen,54,'A54') ELSE '';

-SET &parmlen = IF &CN_NBR_D.LENGTH LT 329 THEN &CN_NBR_D.LENGTH ELSE 329;

-SET &Rep_Parms6 = IF &CN_NBR_D.LENGTH GE 375 THEN SUBSTR
(&CN_NBR_D.LENGTH,'&CN_NBR_D.EVAL',275,&parmlen,54,'A54') ELSE '';

-SET &parmlen = IF &CN_NBR_D.LENGTH LT 384 THEN &CN_NBR_D.LENGTH ELSE 384;


-SET &Rep_Parms7 = IF &C
N_NBR_D.LENGTH GT 330 THEN SUBSTR
(&CN_NBR_D.LENGTH,'&CN_NBR_D.EVAL',330,&parmlen,54,'A54') ELSE '';


This message has been edited. Last edited by: <Mabel>,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
September 19, 2005, 03:26 PM
Francis Mariani
This may not help at all, but have you tried this?

-IF &CN_NBR EQ 0 GOTO DEF05;

-SET &CN_NBR_DX = 'Receiver(s): ' | &CN_NBR_D;

CNNBR/A2000 = '&CN_NBR_DX';
-DEF05
September 19, 2005, 03:38 PM
Tony A
I suppose the main thing is to confirm what error message or number you are receiving.


Depending upon the error, say it was incompatible format or unbalanced string lengths (left and right sides), then the other test is to check the length of the variable that you are trying to insert into your DEFINE. But I bet you've done that already?

What is the exact error you are getting - and please let it not be "EDA No data" !!!

Also, we know the release, but what platform?

In an attempt to reproduce your error, I've just run the following code through on WebFOCUS 5.3.2 and received no problems -
-DEFAULT &CN_NBR = 49 ;
-DEFAULT &CN_NBR_D = '' ;
-DEFAULT &Cnt = 0 ;
-REPEAT :Loop1 &CN_NBR TIMES
-SET &Cnt = &Cnt + 1 ;
-SET &CN_NBR_D = &CN_NBR_D | ',Customer Account ' | &Cnt ;
-:Loop1
-TYPE &CN_NBR_D.LENGTH

DEFINE FILE CAR
-IF &CN_NBR EQ 0 GOTO DEF05;
CNNBR/A2000 = 'Receiver(s): '|'&CN_NBR_D';
-DEF05
END
TABLE FILE CAR
PRINT CNNBR
BY COUNTRY NOPRINT
IF RECORDLIMIT EQ 1
END

This message has been edited. Last edited by: <Maryellen>,



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
September 19, 2005, 04:03 PM
smkt591
The string length I'm trying to execute is greater than 450.

Unfortunately, I don't get a WebFocus error. Just a "500 Internal Server Error" - the resource you requested generated an undertermined server error.