Focal Point
persisting the values

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

November 10, 2006, 06:34 AM
Balaji Gavini
persisting the values
hi,
My scenario is like this.

I am generating a report and in this report i am sorting on a particular column dynamically.I am displaying this report with in the iframe in the html page.But in the html page printer friendly image is there and on clicking on this the report should come in the pdf format.we are able to achieve this. But the problem is when i am clicking the printer friendly image i have to persist the order of sorting same as in the report in the iframe.we tried using global varibles also. But we are not able to catch the sort order.In the PDF format the report is getting generated with the default sort order only.I would be thankful if anyone can help on this.

Thanks and Regards,
Balaji.
November 10, 2006, 10:38 AM
Bernie Ott
Since you are using an HTML page, why don't you try creating a hidden field on the page.

Then, when you perform specific drilldowns, call a javascript function on the main HTML page that sets the hidden field with the values that you want to persist.

You'll probably have to include a -DEFAULT in all your .fexs and relink your .fex in the iFRAME so that the hidden variable is passed to the .fex each time.
November 10, 2006, 10:40 PM
Balaji Gavini
Hi Bernie,
can you please explain me with example.

Regards,
Balaji Gavini
November 13, 2006, 09:50 AM
Tony A
Balaji,

When the "printer friendly" image is clicked, you should treat it exactly as you would a self drill report, i.e. pass all the variables necessary to furnish the report.

Therefore, if you have a variable that controls the sort order then pass that as well.
-* File selfdrill.fex
-SET &ECHO = ALL;
-SET &Rand = EDIT(HHMMSS('A8'),'99$99$99');
-DEFAULT &SortBy = 'FOC_NONE'
-DEFAULT &Format = 'HTML'

SET BYDISPLAY = ON

TABLE FILE CAR
SUM RCOST
    DCOST
 BY &SortBy NOPRINT
 BY COUNTRY
 BY CAR
 BY MODEL
HEADING
" PDF <+0> HTML "
ON TABLE SET ONLINE-FMT &Format
ON TABLE SET STYLE *
  TYPE=TITLE, COLUMN=COUNTRY, FOCEXEC=selfdrill.fex(SortBy='COUNTRY' Format='&Format.EVAL' Rand=&Rand), $
  TYPE=TITLE, COLUMN=CAR,     FOCEXEC=selfdrill.fex(SortBy='CAR' Format='&Format.EVAL' Rand=&Rand), $
  TYPE=TITLE, COLUMN=MODEL,   FOCEXEC=selfdrill.fex(SortBy='MODEL' Format='&Format.EVAL' Rand=&Rand), $
  TYPE=HEADING, ITEM=1, FOCEXEC=selfdrill.fex(SortBy='&SortBy.EVAL' Format='PDF' Rand=&Rand), $
  TYPE=HEADING, ITEM=2, FOCEXEC=selfdrill.fex(SortBy='&SortBy.EVAL' Format='HTML' Rand=&Rand), $
ENDSTYLE
END
-RUN


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 13, 2006, 10:22 AM
Bernie Ott
Balaji,

How are you dynamically resorting the report?

1. Is it by calling the .fex again and redisplaying the entire report again?

OR

2. Are you doing it using some javascript in the web browser.

If 2, then Tony A's solution is the most straight forward and simplest.

If 1, then you aren't retaining anything on the resort, so you'd have to resort to storing info at the HTML level and then passing it when reexecuting the .fex.

Let us know which way your app works.
November 14, 2006, 10:09 PM
Balaji Gavini
hi bernie,

The thing is printer friendly button is on the html page and the dynamic sort link is on the report.I have to persist the values for html .
November 15, 2006, 09:49 AM
Bernie Ott
Then the #2 option is what you need.

In the main HTML page, create your button along with some predefined hidden field that will be passed to the "pretty print" fex.

In the iFrame, when you click on your link, you should actually call a javascript function that exists in the main page, and can set values in the hidden field.

Then, when you click the "pretty print" button, it can pass all parameters required, including the hidden field to the "pretty print" fex.
November 15, 2006, 10:29 AM
Bernie Ott
Here's a working sample of what I'm talking about.

HTML Code first
<!-- Generated by Report Layout Painter -->
<HTML>
<HEAD>
<TITLE>HtmlPage
</TITLE>
<BASE href=HTTP://localhost:8080>
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
function window_onload() {
UpdateData();
// TODO: Add your event handler code here
}
function persist(persistvalue) {
  document.form3.HIDDEN.value=persistvalue;
  alert("now try the pretty print button");
}
</SCRIPT>

<SCRIPT for=window eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto">
<IFRAME id=report1 title=framerpt.fex style="Z-INDEX: 1; LEFT: 20px; WIDTH: 660px; POSITION: absolute; TOP: 190px; HEIGHT: 330px" tabIndex=1 name=report1 requests_list="0" autoExecute="False" elementtype="2">
</IFRAME>
<FORM id=form2 style="Z-INDEX: 2; LEFT: 20px; WIDTH: 178px; POSITION: absolute; TOP: 20px; HEIGHT: 153px" tabIndex=2 name=form2 onsubmit="OnExecute(this);return false;" method=post requests_list="0" fexlist_list="report1" form_prompt_location="1" form_number_of_visible_rows="4" form_number_of_columns="4" vert_dist_between_controls="10" form_hor_dist_between_controls="10" form_dist_between_desc_and_input="10">
<INPUT id=form2Submit style="Z-INDEX: 3; LEFT: 5px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/run16.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 126px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=3 type=submit value=" " name=ITEM1> 
<INPUT id=form2Reset style="Z-INDEX: 4; LEFT: 48px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/reset.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 126px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=4 type=reset value=" " name=reset1> 
<FIELDSET id=form2_formbodyid style="Z-INDEX: 5; LEFT: 5px; OVERFLOW: auto; WIDTH: 168px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 5px; HEIGHT: 121px; BORDER-BOTTOM-STYLE: none" tabIndex=5 formbody="1">
<SPAN id=ITEM2 style="Z-INDEX: 6; LEFT: 0px; WIDTH: 142px; POSITION: absolute; TOP: 0px; HEIGHT: 95px" tabIndex=6 elementtype="32" name="COUNTRY">Country 
<SELECT id=listbox1 style="Z-INDEX: 7; LEFT: 0px; WIDTH: 142px; POSITION: absolute; TOP: 32px; HEIGHT: 63px" tabIndex=7 size=3 name=COUNTRY dfformat="A10" ibiformat="A10" addalloption="1" accept="0" operation datafield="COUNTRY" displayfield="COUNTRY" datasource="CAR.mas" requiredfield="100749008" datatype="1" datafieldtype="INTIGER" sourcetype="typeMaster">
</SELECT> 
</SPAN>
</FIELDSET> 
</FORM>
<IFRAME id=report2 title=persist.fex style="DISPLAY: none; Z-INDEX: 8; LEFT: 480px; WIDTH: 150px; POSITION: absolute; TOP: 140px; HEIGHT: 30px" tabIndex=8 name=report2 requests_list="1" autoExecute="False" elementtype="2">
</IFRAME>
<FORM id=form3 style="Z-INDEX: 9; LEFT: 480px; WIDTH: 235px; POSITION: absolute; TOP: 20px; HEIGHT: 115px" tabIndex=9 name=form3 onsubmit="OnExecute(this);return false;" method=post requests_list="2" fexlist_list="report2" form_prompt_location="1" form_number_of_visible_rows="4" form_number_of_columns="4" vert_dist_between_controls="10" form_hor_dist_between_controls="10" form_dist_between_desc_and_input="10">
<INPUT id=form3Submit style="Z-INDEX: 10; LEFT: 5px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/run16.gif); WIDTH: 155px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 88px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=10 type=submit size=78 value="Pretty Print" name=ITEM3> 
<FIELDSET id=form3_formbodyid style="Z-INDEX: 12; LEFT: 5px; OVERFLOW: auto; WIDTH: 225px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 5px; HEIGHT: 83px; BORDER-BOTTOM-STYLE: none" tabIndex=12 formbody="1">
<SPAN id=ITEM4 style="Z-INDEX: 13; LEFT: 0px; WIDTH: 199px; POSITION: absolute; TOP: 0px; HEIGHT: 57px" tabIndex=13 elementtype="32" name="HIDDEN">HIDDEN 
<INPUT id=HIDDEN style="Z-INDEX: 14; LEFT: 0px; WIDTH: 199px; POSITION: absolute; TOP: 32px; HEIGHT: 25px" tabIndex=14 hspace=0 accept=0 value="Not set yet!" name=HIDDEN addalloption="0" operation datafield displayfield datasource requiredfield="39036888" datatype="0" datafieldtype="CHAR" sourcetype="typeMaster"> 
</SPAN>
</FIELDSET> 
</FORM>
<xml id=ibi_requests>
<requests>
	
<request requestid="0" targettype="0" targetname="report1" sourcetype="typeFex" ibif_ex="framerpt.fex" ibic_server="EDASERVE" ibiapp_app="test">
		
<variables>
			
<variable field="COUNTRY" file="CAR.mas" desc="Country" datatype="0" operation="" default="FOC_NONE" name="COUNTRY" accept="0" type="default" select="0" controltype="9">
			
</variable>
		
</variables>
	
</request>
	
<request requestid="1" targettype="0" targetname="report2" sourcetype="typeFex" ibif_ex="persist.fex" ibic_server="EDASERVE" ibiapp_app="test">
		
<variables>
			
<variable field="HIDDEN" file="" desc="HIDDEN" datatype="0" operation="" default="Not set yet!" name="HIDDEN" accept="0" type="default" select="0" controltype="7">
			
</variable>
		
</variables>
	
</request>
	
<request requestid="2" sourcetype="typeFex" targettype="1" targetname="_blank" ibif_ex="persist.fex" ibic_server="EDASERVE" ibiapp_app="test">
		
<variables>
			
<variable field="HIDDEN" file="" desc="HIDDEN" datatype="0" operation="" default="Not set yet!" name="HIDDEN" accept="0" type="default" select="0" controltype="7">
			
</variable>
		
</variables>
	
</request>
</requests>
</xml>
</BODY>
</HTML>


Now the 1st report called 'framerpt.fex'
-* File framerpt.fex
-DEFAULT &COUNTRY='FOC_NONE'
TABLE FILE CAR
PRINT
     SEATS
BY COUNTRY
BY CAR
BY MODEL
WHERE COUNTRY EQ '&COUNTRY.(FIND COUNTRY IN CAR).Country.';
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=9,
     COLOR='BLACK',
     BACKCOLOR='NONE',
     STYLE=NORMAL,
$
TYPE=DATA,
     COLUMN=N1,
  TARGET='_self',
     JAVASCRIPT=window.parent.persist(COUNTRY),
$
ENDSTYLE
END


Now the 2nd report called 'persist.fex'

-* File persist.fex
-DEFAULT &HIDDEN='Not set yet!'
-TYPE The persisted value = &HIDDEN