Focal Point
[Closed] HTML Composer - Populate listbox from holdfile

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

December 11, 2013, 03:52 AM
SSander
[Closed] HTML Composer - Populate listbox from holdfile
Hi,
I am looking for solution for following problem I have. We are running SQL reportsand catching results to holds in FOCCACHE and after that we designs those results into dashboards. As the list box / radio button values are different from each user - we need to populate list boxes from those holds too.

So I did some research and found such cool JS event as :
IbComposer_populateDynamicCtrl('listboxID');
but I would like to execute this function after the report is done with loading.(right now I have button that executes the function, but this is not nice design for end users).

Has anyone else ran into such problem or maybe can give some other ideas how to solve this.

Regards,
Sander

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


Release: WebFOCUS 8104, AppStudio: 8105
OS: Windows
Output: HTML,Excel,Active Reports
December 11, 2013, 07:46 AM
Dave
SSander,

welcome to the forum.

You can use basic composer functionality to dynamicaly populate controls. You don't need to do it yourself with .js.

...all above assuming it hasn't drastically changed between WF 7 and 8.

G'luck,
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
December 11, 2013, 08:23 AM
SSander
Hi Dave,
This is not that easy Wink

I made following example based on my code:
STATE FOCCACHE/CARHOLD.ftm
-IF &EXITRC EQ 0 THEN GOTO SKIPSQL ELSE GOTO RUNSQL;
-RUNSQL
-* Prepare hold!
TABLE FILE CAR
PRINT 
     CAR.ORIGIN.COUNTRY
     CAR.COMP.CAR
     CAR.CARREC.MODEL
     CAR.BODY.BODYTYPE
     CAR.BODY.SEATS
     CAR.BODY.DEALER_COST
     CAR.BODY.RETAIL_COST
     CAR.BODY.SALES
     CAR.SPECS.LENGTH
     CAR.SPECS.WIDTH
     CAR.SPECS.HEIGHT
     CAR.SPECS.WEIGHT
     CAR.SPECS.WHEELBASE
     CAR.SPECS.FUEL_CAP
     CAR.SPECS.BHP
     CAR.SPECS.RPM
     CAR.SPECS.MPG
     CAR.SPECS.ACCEL
     CAR.WARANT.WARRANTY
     CAR.EQUIP.STANDARD
ON TABLE HOLD AS FOCCACHE/CARHOLD FORMAT ALPHA
END
-SKIPSQL
TABLE FILE CARHOLD
SUM 
     CARHOLD.CARHOLD.DEALER_COST
BY  CARHOLD.CARHOLD.COUNTRY
BY  CARHOLD.CARHOLD.CAR
WHERE ( CARHOLD.CARHOLD.COUNTRY EQ '&COUNTRY.(FIND CARHOLD.CARHOLD.COUNTRY,CARHOLD.CARHOLD.COUNTRY IN carhold).COUNTRY:.' ) AND ( CARHOLD.CARHOLD.CAR EQ '&CAR.(FIND CARHOLD.CARHOLD.CAR,CARHOLD.CARHOLD.CAR IN carhold).CAR:.' );
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
END

As you can see I will skip rerunning the SQL when users make such changes what do not need the database request. But now when I reference this to HTML and create controls to populated from "CARHOLD" file, they will stay empty if the "FOCCACHE" holdfile does not exist. So I am looking for solution maybe some kind of event after the initial run is done - so I could call the JS function to repopulate the list boxes.

Regards,
Sander


Release: WebFOCUS 8104, AppStudio: 8105
OS: Windows
Output: HTML,Excel,Active Reports
December 12, 2013, 03:27 AM
Dave
Ah, yeah.

That's a problem.

We've got a similar construction. ( but with a difference technique ).

-IF &TMPHLDSTS.EXIST NE 0 THEN L_THE_END;

----query here

-SET &TMPHLDSTS = 'J' ;
-L_THE_END


( for other reasons, but it's about the same ;-)



Foccache is, afaik, based on Session. And those populating queries seem to run in an seperate session...

....nasty stuff. I'm afraid I can't help you futher.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
December 12, 2013, 05:47 AM
Wep5622
They only appear to be because by default the HTML generated from HTMLComposer doesn't have FOCCACHE in its path.

If you edit the HTML and add foccache to the attribute-lists for attribute ibiapp_app, the HTML can find them. There's at least one hidden input-field with "ibiapp_app" as id and there are some data_info fields containing the same info (violating the DRY principle, but that's modern thinking).

Unfortunately, on re-opening the HTML in HTMLComposer, that tool still doesn't look in the (manually added) foccache directory and will overwrite those entries again on opening the HTML. So you'll have to apply those changes again each time before you save.

At least, that is how the situation seems to be since about WF7.6.10. I don't know how this behaves (or is supposed to behave) in WF8, but I don't expect a lot of differences.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
December 12, 2013, 03:15 PM
J
You could do something like this in your fex:
 
ON TABLE HOLD AS MYREPORT FORMAT HTML
...

-HTMLFORM BEGIN
<html>
<body onload="parent.IbComposer_populateDynamicCtrl('listboxID');">
!IBI.FIL.MYREPORT;
</body>
</html>
-HTMLFORM END
 


If that doesn't quite work then have a function in the html page and replace the body onload to call that function:

 
<body onload="parent.myfunction();">
 



WebFOCUS 7.7.03/8.0.08
Dev Studio 7.7.03/8.0.08
App Studio 8.0.08
Windows 7
ALL Outputs
December 18, 2013, 02:36 AM
SSander
So after some more research I still solved this with JavaScript/JQuery - so I am checking the event after iframe load to repopulate listboxes.


Release: WebFOCUS 8104, AppStudio: 8105
OS: Windows
Output: HTML,Excel,Active Reports
December 18, 2013, 11:17 AM
BarryS
Hi SSander

Open a case in tech support for this issue I am sure that we can help you. You can ask for Barry when you open the case.

Thanks Barry


WebFOCUS 8103, Windows, App Studio