Focal Point
how to remove the last charater of the variable?

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

July 14, 2008, 12:58 PM
Gobinath Velusamy
how to remove the last charater of the variable?
Hi

My variable ends with , character i want to remove that one and then show it in the report

Example :1. All ,
2. A1,A2,
3.A1,A2,A3,
Mu output should be like that

1.All
2.A1,A2
3.A1,A2,A3

Please help me to solve the issue


Thanks
Gobinath Velusamy


WebFOCUS 7610
Windows
July 14, 2008, 01:39 PM
Prarie
Do a search on STRIP


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
That will remove all instances.

To delete just the final non-blank character you can use ARGLEN (to determine its position) and SUBSTR.


- Jack Gross
WF through 8.1.05
Hi

I cant determine the length ... i t will vary dynamically


WebFOCUS 7610
Windows
Are these dialog manager & variables, or Focus fields? If the latter, are they fixed or variable in length?


- Jack Gross
WF through 8.1.05
There is a REVERSE subroutine. You can flip the contents, check to see if the firt character is a comma, remove it, then flip it back.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
Hi Gopinath,
Can you try this below?

-SET &TEST = 'All,1,2,3,';
-SET &TEST1 = SUBSTR(&TEST.LENGTH, &TEST, 1, &TEST.LENGTH-1, &TEST.LENGTH-1, 'A&TEST.LENGTH');
-TYPE &TEST1


Regards,
Kasi Krishnan
WF 7.1.4 & WF 7.6.9: Databases - DB2, SQL Server 2000.
OS: Windows & AIX
Gobinath,

I think you can use TRIM:
  
-* File strip1.fex
-SET &ST='A1,A2,A34,';
-SET &STL=&ST.LENGTH;
-SET &STM=TRIM('T','&ST.EVAL',&STL,',',1,'A&STL.EVAL');
-TYPE &ST : &STM

However, if the ',' is not the last character in your string and you have trailing blanks, then you should also r-justify your string:
  
-SET &ST='A1,A22,A3425,    ';
-SET &STL=&ST.LENGTH;
-SET &STM=LJUST(&STL, TRIM('T',RJUST(&STL,'&ST.EVAL','A&STL.EVAL'),&STL,',',1,'A&STL.EVAL'),'A&STL.EVAL');
-TYPE &ST : &STM

This message has been edited. Last edited by: Danny-SRL,


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF