Focal Point
getting substring

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

January 09, 2008, 11:57 AM
MacLonghorn
getting substring
In dialog manager, I'm trying to trim the spaces from the end of a string. I tried TRIM, but of course WF expects me to know the length of the result string. So I tried ARGLEN to get it. I don't quite have it. Any help?

-SET &MSG = 'Here I am ';
-SET &LEN = ARGLEN(30, &MSG, 'I2');
-SET &MSG2 = SUBSTR(30, &MSG, 1, &LEN, &LEN, 'A&LEN');
-TYPE '&MSG2'

On a side note, why can't WF figure out how many chars I'm returning if I provide the start/end position? And why must I know how many characters will be returned? *geez*

Thanks in advance
January 09, 2008, 12:07 PM
susannah
-SET &ME = GETUSER('A8');
-SET &AL = ARGLEN( &ME.LENGTH , &ME, 'I2' );
-TYPE results of getuser function is &ME length is &ME.LENGTH Arglen=&AL

The .LENGTH operator will measure trailing blanks. And it works fine as the input to the ARGLEN function.

And update the Signature block inyour profile, so we know what product/release/system you're on.

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




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
January 09, 2008, 12:23 PM
MacLonghorn
good to know about the .LENGTH feature, but I am able to get the length using ARGLEN, b/c I do know the incoming string length. what I'm trying to do is somehow dynamically concatenate the 'A' with the length to format the result. I know there's a way to do it, but apparently the 'A&LEN' doesn't quite do it. (sorry, I had "signature" unchecked)


Thanks.

Mark
WF 7.6 Windows
January 09, 2008, 12:40 PM
MacLonghorn
Yep, that's what I had been looking for. Thanks Tom Guru.


Thanks.

Mark
WF 7.6 Windows
January 09, 2008, 06:44 PM
Piipster
quote:
On a side note, why can't WF figure out how many chars I'm returning if I provide the start/end position? And why must I know how many characters will be returned? *geez*


Some functions like EDIT are part of the FOCUS/WebFOCUS language. Historically, the other functions were known as User Written Subroutines, because that's exactly what they are. They were provided by the FOCUS user community and, therefore, were designed by many different people. That's why you'll see many inconsistencies in the arguments required for the subroutines. My functions manual is always at hand because I don't try to remember the syntax of the different routines.


ttfn, kp


Access to most releases from R52x, on multiple platforms.
January 10, 2008, 09:07 AM
PBrightwell
Because the format is in quotes you have to force it to evaluate the variable.

-SET &MSG2 = SUBSTR(30, &MSG, 1, &LEN, &LEN, 'A&LEN.EVAL');


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes