Focal Point
[SOLVED] HTML Embedded procedures and ...session lifetime?

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

November 29, 2010, 08:19 AM
Wep5622
[SOLVED] HTML Embedded procedures and ...session lifetime?
Hello,

I have a start-fex that stores some data in a HOLD file, which in turn is supposed to be used by an embedded procedure in a HTMLFORM included later on in the same fex. The HOLD-file should be stored on a per-session basis too, so I'm experimenting with FOCCACHE for this.

I have a couple of related questions.

Chickens and eggs...
The first problem is the chicken-and-egg problem of selecting the master file to be used in HTML Composer's interface: Parameters - combobox1 - Dynamic - External Procedure.
Since the HOLD-file is created in the same fex that includes this HTMLFORM, the master isn't available yet at this point. How do you select it? FOCCACHE isn't in the path, and I can't add it either as it's outside my project tree...

I've tried running the start-fex without the HTMLFORM first, to create the master file, so that Dev Studio can pick it up, but that didn't seem to help any.


Hold it!
In the end I added the code for the embedded procedure by hand. The start-fex has this code:
-* File foccache_test.fex
APP HOLD FOCCACHE

TABLE FILE CAR
PRINT MODEL
BY CAR
ON TABLE HOLD AS CARMODEL
END
-HTMLFORM foccache_test.htm


The HTML form is a freshly created one with a dropdown dragged in. The embedded procedure for this dropdown is:
APP HOLD FOCCACHE
TABLE FILE FOCCACHE/carmodel
PRINT MODEL
BY CAR
ON TABLE PCHOLD FORMAT XML
END


If I run this, I can see in the HTML source that the start-fex found 18 lines, but the dropdown box remains empty!:
<!--
0 NUMBER OF RECORDS IN TABLE=       18  LINES=     18

-->


We do have something similar to the above approach working for some other projects, where we use an APP HOLD to the project's local directory (say: APP HOLD CAR). That works, but I can't do that in this case, since we need to keep different sessions apart.

I have gotten this to work by using an APP HOLD &USERID, but as I understand it, FOCCACHE is supposed to replace the need for such abominations.

What I can't get to work though, is this same approach either without an APP HOLD, or by using FOCCACHE. What am I missing?


Documentation?
As much as FOCCACHE is louded as the new approach to... what really? There is not even mention of it in the Help files provided with Dev Studio, and even searching the Technical Documentation Library, the only relevant documents that show up are marketing documents - very low on technical details of how to use FOCCACHE.

Where's the documentation?

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


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 :
November 29, 2010, 10:10 AM
Tony A
FOCCACHE is included in the APP PATH for an individual user so picking up your MAS should not be an issue.

If you APP FI CARMODEL FOCCACHE/carmodel.ftm as the first part of your embedded fex then the data file should be able to be seen OK.

For information APP HOLD is used to direct output files not input files, for that you need APP PATH or, as I mentioned above, APP FILEDEF.

My understanding of FOCCACHE is that it is relevant to the users browser session and will be used whilst that browser session is active. There is a length of time that the contents of FOCCACHE will remain around but what that timing is I do not know.

The reason (as far as I can tell) for FOCCACHE is that, in times gone by, one of the methods utilised to make an individual hold file available to a specific user was to append the user id to the filename and store it in a network share that was available to the server. This required a filedef etc. in subsequent processes and could get rather complex if you let it. Required less now that we have FOCCACHE!

How the usage of FOCCACHE will pan out using it for chained combos I cannot tell but, in theory at least, it should be OK.

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:14 AM
j.gross
You need to add
ON TABLE PCHOLD FORMAT XML

to your embedded procedure
November 29, 2010, 11:40 AM
Wep5622
quote:
Originally posted by j.gross:
You need to add
ON TABLE PCHOLD FORMAT XML

to your embedded procedure


A sharp observation, that certainly doesn't help! Thanks for pointing that out.

Unfortunately, even with the correct output format, the dropdown remains empty. I expected that, I've seen it before; I'm pretty sure that's because the HTTP-request that populates that dropdown doesn't know to look in FOCCACHE.

I already have a case open on a similar issue with paths dynamically altered in the load-fex; the path from the load-fex doesn't seem to propagate to the HTTP-request used to populate the asynchronously loaded dropdown.


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 01, 2010, 12:30 AM
Bethanne
Put a
-RUN
after your table file and before your
-HTMLFORM
December 01, 2010, 06:22 AM
Wep5622
It wasn't the -RUN, but I got it solved.

In the end the below code worked:
-* File foccache_test.fex
APP HOLD FOCCACHE

TABLE FILE CAR
PRINT MODEL
BY CAR
ON TABLE HOLD AS FOCCACHE/CARMODEL
END
-HTMLFORM foccache_test.htm


Note the FOCCACHE/ prefix added in the above.

The embedded procedure for this dropdown is:
TABLE FILE carmodel
PRINT MODEL
BY CAR
ON TABLE PCHOLD FORMAT XML
END


Time to apply this to actual problems! Smiler


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 :