Focal Point
Conditional display in Heading

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

July 30, 2007, 11:03 AM
Mark1
Conditional display in Heading
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
July 30, 2007, 11:18 AM
gregson06
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.
July 30, 2007, 11:29 AM
Mark1
Man, that is awesome! Thanks!


Windows version 768
July 30, 2007, 11:33 AM
Francis Mariani
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
July 30, 2007, 12:11 PM
gregson06
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,
July 30, 2007, 12:51 PM
Francis Mariani
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
July 30, 2007, 01:11 PM
gregson06
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).
July 30, 2007, 03:52 PM
FrankDutch
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

July 31, 2007, 08:14 AM
linus
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