Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Conditional display in Heading
Go
New
Search
Notify
Tools
Reply
  
Conditional display in Heading
 Login/Join
 
Platinum Member
posted
I need to figure out a way to say
HEADING
IF COLUMN1 EXISTS THEN
"COLUMN1"
ELSE IF COLUMN2 EXISTS THEN
"COLUMN1 COLUMN2"
...

Does anybody know the correct syntax to do this? Thanks!


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
I've actually been doing this for a while now and it's great. Basically you need to use the -IF statement in the HEADER.

For example, if you want a certain field to show up if it exists then you would do this:

HEADING
-IF NOT COLUMN1 IS MISSING THEN SHOWCOL1 ELSE
IF NOT COLUMN2 IS MISSING THEN SHOWCOL2;
-SHOWCOL1
put your column1 header text here, with quotes of course!
-SHOWCOL2
put your column2 text here

The thing about the -IF statement is that it works almost like a conditional GOTO statement (as far as I've seen). Basically you are specifying the conditions to when you want the program to jump to the next scenario. I use this technique when I want to let users be able to leave a parameter blank and have the program jump out of a selection statement and go directly to showing everything in the report. You can use this in the selection area (the WHERE's) in the report as well.

You do need to play around with it to make sure your criteria is caught correctly. I know that using the condition " NE '' " (not equal to blank) makes random results appear, so just be prepared to run the report several times. Searching for the "IS MISSING" sounds like what you want to do there, though. Hope this helps!

BTW, the semicolon at the end of the -IF statement is usually required, but put it there anyway incase WebFOCUS has a fit about it, the error will say something like "missing or incomplete argument" on that line.
 
Posts: 87 | Registered: August 03, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Man, that is awesome! Thanks!


Windows version 768
 
Posts: 215 | Registered: March 16, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
gregson06,

I'd really like to see a working example of what you've described here. I can't see how you can use Dialogue Manager to determine if a column exists in a Master with the "-IF NOT COLUMN1 IS MISSING" statement, if, indeed, that is what it's doing.

Cheers.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Well, I don't believe the column definition itself can be "checked" to exist, but the column value is what I meant.

A column has to exist in order to reference it (as far as I am aware of). In that manner, Francis, I do agree that a column cannot be checked to exist in a master.

Please make sure that the columns exist, the example above would only work if column1 (let's say CARORDERS) were not null or if column2 (let's call this one TRUCKORDERS) were not null.

Mark1, were you trying to find out if the field existed in a table or the value in the field?

Thanks!

PS. A little more clarification.

Whether a column "exists" in the meaning of the definition would be like this:

CONTENTS OF TABLE A:

CAR
MAKE
MODEL
YEAR

If we wanted to see if a column called DEALER existed in TABLE A then it would not be doable since the field definition does not exist in TABLE A's master, or table description. You can't reference it.

If we wanted to see if the column YEAR were missing information (as in no values whatsoever) then the example above would work as far as checking the values.

This message has been edited. Last edited by: gregson06,
 
Posts: 87 | Registered: August 03, 2006Reply With QuoteReport This Post
Expert
posted Hide Post
I don't see how this would work for a column value either.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Platinum Member
posted Hide Post
The IS MISSING or using -IF in a header? I tried creating a temp table with the CAR minitable in order to produce null values but to no avail (it seems I can only do SQL EQUIJOINS).
 
Posts: 87 | Registered: August 03, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
What you want is first test if all the records of a certain field have a null value and in that case you want to suppress that field.
I think this issue is brought up before here and as far as I remember you have to go to several tests and hold files before you can build the end report.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Instead of a hold file create a save file and perform a -read to see if the value exists and setting and &var for your heading then use the &var in your heading.


WF 7.7.05
HP-UX - Reporting Server, Windows 2008 - Client, MSSQL 2008, FOCUS Databases, Flat Files
HTML, Excel, PDF
 
Posts: 149 | Location: Dallas, TX | Registered: June 08, 2007Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Conditional display in Heading

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.