Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] if... then (do nothing)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] if... then (do nothing)
 Login/Join
 
Gold member
posted
Question-
If I have something like:
IF &POSTVAR EQ ' ' THEN '' ELSE &POSTVAR;

Why does this return a blank space in PDF, much like a ' ' would, even though I am using ''? I have a header with multiple search criteria from an HTML form that I want to only display when a user fills in that specific form field. There's quite a few (well over a dozen) fields. The problem is if a user only fills in one or two fields, I get odd spacing in my PDF report heading between the variables.

Like:
Document Type: All, ______ Sort by: Type
and it appears to be the variables in between the two showing that are causing the space. (substituted ___ for a space)

Is there something like
IF &POSTVAR EQ ' ' THEN NULL ELSE &POSTVAR?
Or any other ideas?
Thanks in advance!

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


WebFOCUS 7.6.3 | Solaris 10 | Excel, PDF
 
Posts: 46 | Location: Austin TX | Registered: June 04, 2009Report This Post
Expert
posted Hide Post
Is this a DM -SET of a varaible or DEFINE of a new file? What's the complete line of code which is causing this issue? (enclose your code within the [code] tags.)
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
Try:
IF &POSTVAR NE ' ' THEN &POSTVAR ;
without the else. Instead of:
IF &POSTVAR EQ ' ' THEN NULL ELSE &POSTVAR;
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
I have always advised users to use the full construct:
IF ... THEN ... ELSE ...;

Also, I'm pretty positive that &variables cannot contain a NULL value. So, if one wants to do away with the balnks in PDF one should use spot markers. See the following example. Run it once as is, then a second time with -SET &MORE=' ';
  
-* File Bdavis1.fex
-SET &MORE='words';
-SET &X1=IF &MORE EQ ' ' THEN '-2' ELSE '+0';
TABLE FILE CAR
HEADING
"WORDS <&X1 &MORE WORDS"
PRINT COUNTRY
ON TABLE PCHOLD FORMAT PDF
END


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

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Virtuoso
posted Hide Post
The value of a dialog manager variable cannot be an empty string; 1 is the minimum length. When you attempt to assign it an empty string, WF sets the variable to a blank string of length 1.

(Note that an undefined amper variable will have zero as its .LENGTH and .EXISTS attributes, and U as its .TYPE)


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
BDAVIS: I hope THEIR inputs helped.
Danny-SRL: Nice use of spot marker.
Jack: Thanks for the elaboration.
Doug: What was I thinking? Or, was I?
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Gold member
posted Hide Post
These are -SET variables.

quote:
Try:
IF &POSTVAR NE ' ' THEN &POSTVAR ;


I had tried that, but then you get a FOC295 error (value is missing) for the variable.

I appreciate the info, Jack. I had imagined something like that was happening regardless.

Danny, that's a good idea, but I'm taking all my postvars, concatenation them together then running that through a parag/gettok to break it down to multiple lines before displaying in my PDF header. I don't know how I could make your method work without ditching what I've accomplished so far.

Here's a little example of what I'm doing to clarify:
-SET &DOC_NUM = IF &DOC_NUM EQ ' ' THEN '' ELSE ', DCC #: '|&DOC_NUM ;
-SET &DOC_STATUS = IF &DOC_STATUS EQ ' ' THEN '' ELSE ', DCC #: '|&DOC_STATUS ;
-SET &DOC_TYPE = IF &DOC_TYPE EQ ' ' THEN '' ELSE ', Document Type: '|&DOC_TYPE;

-SET &SEARCHHEAD = &DOC_NUM||&DOC_STATUS||&DOC_TYPE;

(define)
HD_SRCH/A1500='&SEARCHHEAD.EVAL';
PARAGSB/A1500 = PARAG(1500, HD_SRCH, '|', 175, PARAGSB);
 SUBB1/A175 = GETTOK(PARAGSB, 1500, 1, '|', 175, SUBB1);   
 SUBB2/A175 = GETTOK(PARAGSB, 1500, 2, '|', 175, SUBB2);   
 SUBB3/A175 = GETTOK(PARAGSB, 1500, 3, '|', 175, SUBB3);   
 SUBB4/A175 = GETTOK(PARAGSB, 1500, 4, '|', 175, SUBB4);


(and then listing out each SUBB# variable in my style header with a little trickery to determine how many SUBB# lines I actually want to type out in the header - to avoid a big gap between the header and report if the search criteria only takes up one line)

There are actually probably 20 or so &DOC_* variables, enough to take up 4 lines of 8 point font on a PDF landscape. Users are filling in HTML form fields with search criteria that are used in selecting data in the report, so we want to display what criteria they enter in the header of the report. This has been the only way I have been able to accommodate so many variables (ranging anywhere from 1-20ish of 'em).

So that's where I'm at on this one. I take it I've reached a deadend.
Thanks,
B

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


WebFOCUS 7.6.3 | Solaris 10 | Excel, PDF
 
Posts: 46 | Location: Austin TX | Registered: June 04, 2009Report This Post
<JG>
posted
best way to handle it is to use something like '~' for a missing situation
and then use the STRIP function to removethem before using PARAG
 
Report This Post
Gold member
posted Hide Post
quote:
best way to handle it is to use something like '~' for a missing situation
and then use the STRIP function to removethem before using PARAG


Ding ding! PERFECT.
Thanks


WebFOCUS 7.6.3 | Solaris 10 | Excel, PDF
 
Posts: 46 | Location: Austin TX | Registered: June 04, 2009Report This Post
Virtuoso
posted Hide Post
If I understand correctly, you'd like to use something like WHEN logic to make TABLE suppress the non-significant HEADING lines -- but WHEN applies to subhead, not a page heading. On the other hand, you could dynamically control the number of heading lines generated -- except that dialog manager cannot test a file's data variables.

The solution is kinda obvious: Do all the data manipulation (mark with PARAG, split with GETTOK) in dialog manager variables, and use those to control the generation of code lines.

Test the &SUBx values in a reverse -REPEAT loop to determine how many significant lines resulted. Use another -REPEAT to DEFINE that many SUBx/A175 vars, and another one to generate that many lines of HEADING text containing

- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Gold member
posted Hide Post
Jack,
I actually just used a simple GOTO method to dynamically generate the number of lines I need in the header. I guess it's not exactly pretty, but it does do the trick:

HDLEN is just a character count of &SEARCHHEAD
-IF HDLEN LT 150 THEN GOTO 1LINE
-ELSE IF HDLEN GT 150 THEN GOTO 2LINE
-ELSE IF HDLEN GT 300 THEN GOTO 3LINE
-ELSE IF HDLEN GT 450 THEN GOTO 4LINE;

-1LINE
"<SUBB1 "
-GOTO STYEND;

-2LINE
"<SUBB1 "
"<SUBB2 "
-GOTO STYEND;

-3LINE
"<SUBB1 "
"<SUBB2 "
"<SUBB3 "
-GOTO STYEND;
..
-STYEND

..and so on.


WebFOCUS 7.6.3 | Solaris 10 | Excel, PDF
 
Posts: 46 | Location: Austin TX | Registered: June 04, 2009Report This Post
Virtuoso
posted Hide Post
I presume it's &HDLEN in the real fex.

Note that, as it stands, 0 through 150 will go to 1LINE, and any value over 150 will go to 2LINE.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
-SET &FF = 'fred';
-TYPE LENGTH= &FF.LENGTH EXIST = &FF.EXIST
(you'll get 4 and 1 )

-SET &FF = ;
-TYPE LENGTH= &FF.LENGTH EXIST = &FF.EXIST
(you'll get 0 and 0 , neat!)

that's how you empty out an &var after you have used it and finished with it and you want it nuked.

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




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
quote:

It's not &HDLEN.


Well, it is &HDLEN. DM assumed it to be an &variable. I strongly suggest you put the &, because in one future version it will cause an error...

As for your -IF statement, it should be:
  
-IF &HDLEN LT 150 THEN GOTO 1LINE
- ELSE IF &HDLEN LT 300 THEN GOTO 2LINE
- ELSE IF &HDLEN LT 450 THEN GOTO 3LINE
- ELSE GOTO 4LINE;

Notice the blank between the - and ELSE.

Last of all, there is no need for a ; at the end of an unconditional -GOTO


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

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Virtuoso
posted Hide Post
Then, as far as '-IF' is concerned, HDLEN is just a character string.

If you're certain 150 characters per line works:

TABLE ...
HEADING
"..."
-SET &HDLEN = ARGLEN( ... );
-IF &HDLEN LE 150 THEN GOTO 1LINE
-ELSE IF &HDLEN LE 300 THEN GOTO 2LINE
-ELSE IF &HDLEN LE 450 THEN GOTO 3LINE
-ELSE GOTO 4LINE;
1LINE
...


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Gold member
posted Hide Post
All,
Thank you for the help. I realized I had sent a crappy version of my code earlier and that it needed to be fixed some. It also turned out that I needed to move some variables around.

I had HDLEN = ARGLEN(...) located in a define and then was calling that. It helped to move that to a -SET like this:
-SET &HDLEN = ARGLEN(1500, '&SEARCHHEAD.EVAL', 'I2');


Then work with that in a -SET to determine how many lines to use:
-SET &NUMLINES = IF &HDLEN FROM 0 TO 150 THEN 'A' 
- ELSE IF &HDLEN FROM 151 TO 300 THEN 'B' 
- ELSE IF &HDLEN FROM 301 TO 450 THEN 'C' 
- ELSE IF &HDLEN FROM 451 TO 600 THEN 'D';


And finally, in the style sheet use this
-IF &NUMLINES EQ 'A' THEN GOTO 1LINE
-ELSE IF &NUMLINES EQ 'B' THEN GOTO 2LINE
-ELSE IF &NUMLINES EQ 'C' THEN GOTO 3LINE
-ELSE IF &NUMLINES EQ 'D' THEN GOTO 4LINE
-ELSE GOTO 4LINE;


That way the actual range values are a little more centralized. I am still pretty new to webfocus, so I appreciate the patience & guidance...


WebFOCUS 7.6.3 | Solaris 10 | Excel, PDF
 
Posts: 46 | Location: Austin TX | Registered: June 04, 2009Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] if... then (do nothing)

Copyright © 1996-2020 Information Builders