Focal Point
[CLOSED]Getting hidden characters on truncate

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

May 04, 2016, 04:52 AM
Kartik Katyal
[CLOSED]Getting hidden characters on truncate
I am getting the value for region in an amper variable and truncating it to remove trailing spaces.

-READ HOLD, ®ION

-SET ®ION2 = TRUNCATE(®ION);

-TYPE (®ION2.LENGTH)

-*SET ®ION2 = 'US';
-IF ®ION EQ US THEN GOTO :US ELSE IF ®ION EQ Europe THEN GOTO :EMEA ELSE IF ®ION EQ LACC THEN GOTO :LACC ELSE GOTO :JAPA;

However, it seems to have some hidden characters which is why the simplest of If condition is failing.

Length of region post truncate is always 2 more than what it should be.

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


WebFOCUS 8010,8204
Windows
May 04, 2016, 08:25 AM
MartinY
There is no reason that the length impact the test.
If your test fail, it's due to something else.

TABLE FILE CAR
BY COUNTRY AS 'CNTRY'
WHERE COUNTRY EQ 'FRANCE';
-*WHERE COUNTRY EQ 'W GERMANY';
-*WHERE COUNTRY EQ 'ITALY';
ON TABLE HOLD AS HLD FORMAT BINARY
END
-RUN

-READFILE HLD

-IF &CNTRY EQ 'W GERMANY' THEN GOTO :US ELSE IF &CNTRY EQ FRANCE THEN GOTO :EMEA ELSE IF &CNTRY EQ ENGLAND THEN GOTO :LACC ELSE GOTO :JAPA;
-:US
-TYPE TEST RESULT = US, CNTRY: &CNTRY, CNTRY LENGTH: &CNTRY.LENGTH
-GOTO XEND;
-:EMEA
-TYPE TEST RESULT = EUROPE, CNTRY: &CNTRY, CNTRY LENGTH: &CNTRY.LENGTH
-GOTO XEND;
-:LACC
-TYPE TEST RESULT = LACC, CNTRY: &CNTRY, CNTRY LENGTH: &CNTRY.LENGTH
-GOTO XEND;
-:JAPA
-TYPE TEST RESULT = JAPAN, CNTRY: &CNTRY, CNTRY LENGTH: &CNTRY.LENGTH

-XEND

This message has been edited. Last edited by: MartinY,


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
May 04, 2016, 08:29 AM
Squatch
quote:
Originally posted by Kartik Katyal:

-IF ®ION EQ US...

Shouldn't "US" have single quotes around it?

Like this:

-IF ®ION EQ 'US'...



App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
May 04, 2016, 08:36 AM
MartinY
It does work anyway without the quotes since there is no spaces in the tested value.

In my above sample, it won't work if I will have tested W GERMANY without quotes.


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
May 04, 2016, 11:09 AM
EricH
If you do a -TYPE on &ION and &ION.LENGTH both before and after the TRUNCATE what do you see?
May 04, 2016, 01:04 PM
GavinL
Instead of READ, have you tried READFILE.. Much easier to use and it doesn't care if your sizing if 1 byte off or not.

-READFILE HOLD
-SET &ION2 = TRUNCATE(&ION);

-TYPE (&ION2.LENGTH)

-*SET &ION2 = 'US';
-IF '&ION' EQ 'US' THEN GOTO :US ELSE IF '&ION' EQ 'Europe' THEN GOTO :EMEA ELSE IF '&ION' EQ LACC THEN GOTO :LACC ELSE GOTO :JAPA;




- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
May 04, 2016, 01:32 PM
j.gross
quote:
Instead of READ, have you tried READFILE.. Much easier to use

... as long as the column and amper var names match.

I was going to suggest that, and also ask to post the HOLD MASTER file. If the HOLD data are not comma-delimited, then perhaps the comma in the -READ will result in the trailing CR LF becoming part of the value of &REGION


- Jack Gross
WF through 8.1.05