Focal Point
function question

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

May 11, 2006, 10:16 AM
Mark1
function question
I'm trying to take out trailing blanks using the squeez function, but as an argument of that function you have to specify the number of bytes of the new variable. So, if my number of bytes is longer than the actual text I want out of my original variable, isn't the new variable just going to be padded with trailing spaces? What is the point of this function?


Windows version 768
May 11, 2006, 10:37 AM
Kamesh
One use I found was, in one of my client they need the data to be displayed as

text:value

In database, this data has a format like

text:         value

Hope this helps,


WFConsultant

WF 8105M on Win7/Tomcat
May 11, 2006, 10:45 AM
j.gross
It's useful in dialog manager, where you can change a variable's length (and specify it dynamically in the call's final argument using .EVAL).


- Jack Gross
WF through 8.1.05
May 11, 2006, 10:48 AM
<JG>
Mark1 squeez is not for removing trailing blanks it's for converting multiple blanks to a single blank.
YOU need the trim function
May 11, 2006, 11:26 AM
susannah
and, continuing on from JG, you can use the ARGLEN function to determine how long the resulting field needs to be
and put that number into your TRIM function, if you like.
Are you in DM or in a Define?




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
May 11, 2006, 01:36 PM
Mark1
But the Trim function requires a number of bytes for the output variable also. Therefore, I would have the same problem. And I understand about the ARGLEN function as an argument of the Trim function, but wouldn't that just use the longest text value of that field as the variable length? Therefore, anything shorter would have trailing spaces.

My overall objective is to export a text file out of Webfocus using ON TABLE HOLD AS PCMHDET FORMAT COMT. When I do that, most of the fields are exactly as they should be: If there is a value in a field shorter than another value in that same field, then they look like this:

VARIABLE1
"ABCDEFGHE"
"ABC"

But there is one field that is not coming over correctly. I define it as A50 in my program. It comes over with the ending quotes way off to the right, in other words, with trailing spaces.

Now there are other defined fields as A50, that come out just fine on the text file without those trailing spaces.

Thank you for your help!


Windows version 768
May 11, 2006, 02:04 PM
susannah
Thats why i asked if you were in DM or in a DEFINE. Its easy to handle the output format change...just tell me which environment you're in, and i'll show you how.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
May 11, 2006, 03:13 PM
Tony A
Mark1,

Have you tried using a variable length field e.g. A50V to see if that helps?

T



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 
May 11, 2006, 04:21 PM
Mark1
I'm in DM.

One more thing while I'm here:

Can you do a "NOT IN..." statement in webfocus? I've got this:

LASTNAME/A50 = IF TOKENFOUR NOT IN ('JR', 'SR', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VIII', ' ') THEN TOKENFOUR ELSE TOKENTHREE;

and it gives me the error that I should use IN in a valid clause. What's the deal with that?

If I just say IN ('.... its fine.


Windows version 768
May 12, 2006, 03:20 AM
Tony A
Mark,

In answer to your last question, (I'll leave Susannah to reply to your first one Smiler) try -

LASTNAME/A50 = IF NOT (TOKENFOUR IN ('JR', 'SR', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VIII', ' '))
 THEN TOKENFOUR ELSE TOKENTHREE;


Or reverse it to give the true result first -

LASTNAME/A50 = IF TOKENFOUR IN ('JR', 'SR', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VIII', ' ')
 THEN TOKENTHREE ELSE TOKENFOUR;


T



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 
May 12, 2006, 08:08 AM
Mark1
Thank you Tony A.! You don't know how much headache that saves me!


Windows version 768