Focal Point
[SOLVED] Create a single line variable

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

April 15, 2015, 01:18 PM
Jonathan K.
[SOLVED] Create a single line variable
I have a variable that is being output on 2 lines and would like it to be on a single line since it's causing some issues.

Example Output:

TABLE FILE CAR
PRINT CAR
WHERE CAR EQ '&CAR'
END

Variable is being input below:

TABLE FILE CAR
PRINT CAR
WHERE CAR EQ '
TOYOTA'
END


I've tried as many functions as I can but it isn't work and is clearly causing issues.

Thanks.

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


WebFOCUS 7.6
Windows, All Outputs
April 15, 2015, 02:04 PM
j.gross
Do you know why is it wrapping to a second line?

What exactly does your variable (represented by &CAR in your posted code) contain -- what is its length, are there embedded newline characters, is it a single right-justified value (as you illustrate), or something more interesting? And how did the value get into the variable in the first place?

If you can answer that, then perhaps we can offer advice -- or perhaps you'll not be needing it.


- Jack Gross
WF through 8.1.05
April 15, 2015, 02:04 PM
MartinY
From where does &CAR is populate or assigned ? This is where you have to look at.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
April 15, 2015, 02:24 PM
Jonathan K.
I am creating a hold file and then using -READ to assign each one to a new variable.

TABLE FILE CAR
PRINT
DST.CAR
ON TABLE HOLD AS CARS
END

-SET &I = 1;

-REPEAT CARLOOP &LINES TIMES
-READ CARS NOCLOSE &CAR.A16.
-SET &CAR.&I = &CAR;
-SET &I = &I + 1;
-CARLOOP

This is just an example of what I am doing.

This message has been edited. Last edited by: Jonathan K.,


WebFOCUS 7.6
Windows, All Outputs
April 15, 2015, 02:40 PM
MartinY
Consider following instead:

TABLE FILE CAR
BY CAR
ON TABLE HOLD AS CARS
END
-RUN

-SET &I = 0;

-REPEAT CARLOOP &LINES TIMES
-SET &I = &I + 1;
-READ CARS &CAR.A16.
-SET &CAR.&I = &CAR;
-TYPE &CAR.&I
-CARLOOP



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
April 15, 2015, 04:46 PM
Jonathan K.
I was able to get it to work some other way.

On the hold file I used FORMAT ALPHA then during the loop I used the EDIT function to extract what I wanted.

Thanks.


WebFOCUS 7.6
Windows, All Outputs
April 16, 2015, 07:51 AM
MartinY
Hi Jonathan,

Will be great if you can share detailed solution with us by including your code, it can help other.

Also, edit the first post and add [SOLVED] at the beginning of your subject.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007