Display the report name in the HTML page dynamically based on a field
Hi,
Is there a way to display the report heading in a HTML page dynamically based on some field value in the report :
Say this is the sample code : TABLE FILE CAR PRINT COUNTRY END -RUN -EXIT
Say assuming that COUNTRY field has only 1 value and this value keeps on changing in the database and I need this field value to be used as the report name in the HTML page.I tried using a textbox and other controls but nothing is working.
Have you tried assigning the value to a variable and then display it ?
Something such as (still assuming that COUNTRY as only one value):
TABLE FILE CAR
BY COUNTRY
WHERE RECORDLIMIT EQ 1;
ON TABLE HOLD AS TITLVAL FORMAT BINARY
END
-RUN
-READFILE TITLVAL
-RUN
-SET RPTTITLE = &COUNTRY;
-HTMLFORM BEGIN
<HTML>
<HEAD>
<TITLE>!IBI.AMP.#RPTTITLE;</TITLE>
</HEAD>
<BODY style="OVERFLOW: auto" thumbnailscale="4" elementtype="21" edaconnectionrequired="false">
<SPAN tabIndex=1 id=text1 style="HEIGHT: 40px; WIDTH: 300px; POSITION: absolute; LEFT: 130px; Z-INDEX: 1; TOP: 40px">!IBI.AMP.#RPTTITLE;</SPAN>
</HTML>
-HTMLFORM END
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
January 21, 2015, 07:47 AM
Danny-SRL
You could also insert the value into TITLETEXT:
TABLE FILE CAR
BY COUNTRY
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE HOLD AS TITLVAL FORMAT BINARY
END
-RUN
-READFILE TITLVAL
-RUN
TABLE FILE CAR
WHERE COUNTRY EQ 'ENGLAND';
PRINT SALES
BY CAR BY MODEL BY BODYTYPE
ON TABLE SET STYLE *
TYPE=REPORT, TITLETEXT='&COUNTRY',$
ENDSTYLE
END
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
January 21, 2015, 07:47 AM
info4pal
Hi Martin,
Thanks a lot for the quick response. But unfortunately am using the HTML Composer and is there any way to do it in the HTML Composer which is linked to the fex.
TABLE FILE CAR
BY COUNTRY
WHERE READLIMIT EQ 1;
ON TABLE HOLD FORMAT ALPHA
END
-RUN
-READ HOLD &RPT_TITLE.A10.
-SET &COUNTRY = &RPT_TITLE;
-TYPE &RPT_TITLE
TABLE FILE CAR
PRINT
*
WHERE COUNTRY EQ '&COUNTRY';
HEADING
"Report Title : &RPT_TITLE"
""
ON TABLE SET PAGE-NUM NOLEAD
END
As this is via HTML composer, I would suggest using an AJAX routine to execute a report that will return the value that you want and then insert that into the TITLE component of the DOM.
The jQuery code to change the title component is -
My solution does work in HTML Composer. I gave you a HTML form just to show you my technique.
1- In the default domain, open HTML Composer (saved as myhtml.htm per example) 2- Add a text field 3- As the text in the text field put:
!IBI.AMP.#RPTTITLE;
4- Create a fex with the following:
TABLE FILE CAR
BY COUNTRY
WHERE RECORDLIMIT EQ 1;
ON TABLE HOLD AS TITLVAL FORMAT BINARY
END
-RUN
-READFILE TITLVAL
-RUN
-SET RPTTITLE = &COUNTRY;
-* syntax for version 8
-HTMLFORM IBFS:/WFC/Repository/DefaultDomain/std_reports/report/myhtml.htm
6- Execute fex in -5-
You should have your text field displaying the variable value.This message has been edited. Last edited by: MartinY,
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007