Focal Point
[CLOSED] Hiding the field if no data present

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

November 29, 2010, 04:04 AM
Zak
[CLOSED] Hiding the field if no data present
I trying to work on a report where the field should be hidden if the field has no value to be displayed. Is there any way in WF by which i can achieve this. Thnx

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


Webfocus 7.6.1, OS:Windows, Output:HTML,PDF,EXCEL,XML
November 29, 2010, 05:38 AM
Dave
Try this:

First query what you want to query and HOLD it.
Then query that hold checking on conditions for display or not.
Check the output and fill a parameter accordingly
Query the hold again for user output..

CAR sample:
TABLE FILE CAR
	SUM SALES
	CNT.MODEL AS MODELS
	BY COUNTRY
WHERE COUNTRY EQ 'FRANCE'
ON TABLE HOLD AS H01 FORMAT FOCUS
END

TABLE FILE H01
	SUM SALES
	BY COUNTRY
WHERE SALES GT 0;
ON TABLE HOLD AS H02 FORMAT FOCUS
END
-RUN

-SET &SHOW_IT = IF &LINES EQ 0 THEN 'NOPRINT' ELSE '';

TABLE FILE H01
	PRINT SALES &SHOW_IT
         MODELS
BY COUNTRY
ON TABLE PCHOLD FORMAT HTML
END


In the first query country FRANCE is selected. SALES is not shown.
Change it to JAPAN and SALES will be shown.

G'luck, Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
November 29, 2010, 07:04 AM
Tony A
You could also achieve this in one pass of the data. However, you wil need to be very sure of the impending output to ensure that your "hidden" column performs as you would wish -
SET NODATA = ''
-DEFAULT &Model   = 'V12XKE AUTO'
DEFINE FILE CAR
  TRANSCOL/D12 MISSING ON = IF SEATS GT 2 THEN SEATS ELSE MISSING;
  TRANSHDR/A6 MISSING ON  = IF SEATS GT 2 THEN 'Seats' ELSE MISSING;
END
TABLE FILE CAR
  SUM TRANSCOL  AS ''
      RCOST     AS ''
      DCOST     AS ''
   BY COUNTRY   AS ''
   BY CAR       AS ''
   BY MODEL     AS ''
WHERE MODEL EQ '&Model'
HEADING
"Country<+0>Manufacturer<+0>Model<TRANSHDR>Retail Cost<+0>Dealer Cost"
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
  GRID=OFF, SIZE=9, $
  TYPE=HEADING, HEADALIGN=BODY, $
ENDSTYLE
END

This restricts the data to such an extent that I kno only on row will be reported and that the column will be "hidden", howver, if I resticted it by CAR EQ 'JAGUAR' then the hidden row would not be relevant to all the reported rows.

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 
November 29, 2010, 10:10 AM
Zak
Thank you all for the responses. I wil try each of those options. Butcan anybdy point what is wrong with code i have written
================================================
DEFINE FILE XYZ
TITLE/A30=IF TITLE_DESC NE'' THEN 'TITLE DESCRIPTION'
END
-IF TITLE_DESC EQ '' THEN GOTO NODISPLY;
TABLE XYZ
BY TITLE AS ''
BY TITLE_DESC AS ''
ON TABLE HOLD FORMAT PDF

then styling

ENDSTYLE
END
-RUN
-NODISPLY
================================================
Each field displays only one value and report is PDF Free form report. Please help me with dis code as to i donno wat is wrong with dis code..

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


Webfocus 7.6.1, OS:Windows, Output:HTML,PDF,EXCEL,XML
November 29, 2010, 10:15 AM
Tony A
TITE_DESC is a field within your file and is therefore not known to dialogue manager (-IF TITLE_DESC ....).

You are not alone in making this new user assumption and you will not be the last, however it will benefit you understanding about dialogue manager and how it is used and executed.

T

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 
November 29, 2010, 10:26 AM
Dave
Sounds like you not only what to not display a colomn, but an entire table?

TABLE FILE ******
ON TABLE HOLD AS H01 FORMAT FOCUS
END
-RUN
-IF &LINES EQ 0 THEN GOTO NODISPLY

TABLE FILE H01
SUM / PRINT
BY / ACROSS
...
...
END

-NODISPLY


?


_____________________
WF: 8.0.0.9 > going 8.2.0.5
November 29, 2010, 10:34 AM
Zak
Lemme explain wat exactly i m looking for...
i have table to displayed in which i hav to customise few fields in such a way that dey shud not be displayed when those fields hav no data in it. If the fields hav data only den those fields shud be displayed. I have jus a posted a piece of the code taking a field as example.

Report looks smthng like dis..

ACCOUNT : 123
TITLE : ENGINEER
TITLE DESCRIPTION : MECHANICAL
TYPE :
CONTACT NUMBER :
-----------------------------------------------------
In above report 2 of the fields doesnot have data thus those FILEDS should NOT be displayed in my report. Only ACCOUNT, TITLE, TITLE DESCRIPTION SHOULD BE DISPLAYED.

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


Webfocus 7.6.1, OS:Windows, Output:HTML,PDF,EXCEL,XML
November 29, 2010, 10:46 AM
Tony A
J.G.

A fine example to accompany your reference a few days ago!!!

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 
December 01, 2010, 12:49 AM
Bethanne
You did not tell FOCUS what to do if
the TITLE_DESC is blank... but if you do not define
an else case, it will hold the value from the previous record. Also be tidy, end each defined
field with a ; This only works because the define statement is the last one before the end.


DEFINE FILE XYZ
TITLE/A30=IF TITLE_DESC NE'' THEN 'TITLE DESCRIPTION'
ELSE ' ';
END
Additionally if you do not want any of the
record to appear if the title is blank add the
if statement


TABLE XYZ
BY TITLE AS ''
BY TITLE_DESC AS ''
IF TITLE_DESC NE ' '
ON TABLE HOLD FORMAT PDF

then styling

ENDSTYLE
END
-RUN
-NODISPLY[/quote]
December 01, 2010, 05:21 PM
FrankDutch
did you look at the command "OVER"

that might be the solution for this

the other way is a bit more complex and not easy to type here in a few rows...

put the data in an other hold file that has only 4 fields

keyfield
keysequence
fieldname
fieldvalue

now you can run a report that says

TABLE XXXX
PRINT FIELDNAME FIELDVALUE
BY KEYFIELD
BY KEYSEQUENCE
ON KEYFIELD SUBHEAD
""
WHEN FIELDVALUE NE '';
END


I hope this helps a bit

(think of Transposing the database from colums to rows)




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