I have some slow reports, and when data is retreived, I'd like to reuse it to display in differnet format, like pdf, excel or just different html presentation, i.e. different request from user. I've got to be sure saved data will not be shared with other users, because the same fex could be called with different parameters and produce completely different data. I found some articles on techsupport site like 'How to reuse HOLD data and output to different formats?' (Case: 81541105), but it saves output in hardcoded file. Looks like it could be overriten by other session. Is it possible to share saved file only between requests that belong to the same session?
Thanks Victorov
November 14, 2005, 12:12 PM
Francis Mariani
Each agent on the WebFOCUS server has its own temporary workspace. You cannot guarantee that a new request will run with the same agent, hence with the same temporary workspace. That's why you need to save the data in a file outside the temporary workspace. The file name does not have to be "hardcoded". It could be based on the User ID, program name, or something else that can be determined the next time the request is made.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 14, 2005, 12:17 PM
<JG>
For a particular WebFocus request the Work directory is unique.
Providing that your filedef is of the form
FILEDEF file DISK file.format
then the file will be created in that unique work area. (This does not apply for pooled deployement)
Do not filedef with Directory/Path details and you should not have a problem.
ALSO note YOU MUST NOT use the setting SET TEMPERASE=OFF as this means old user/temp files could still exist in the working directory.
JG
November 14, 2005, 12:22 PM
<JG>
quote:
Originally posted by JG: For a particular WebFocus request the Work directory is unique.
Providing that your filedef is of the form
FILEDEF file DISK file.format
then the file will be created in that unique work area. (This does not apply for pooled deployement)
Do not filedef with Directory/Path details and you should not have a problem.
ALSO note YOU MUST NOT use the setting SET TEMPERASE=OFF as this means old user/temp files could still exist in the working directory.
If you want a persistant connection then you need to call the reports via Maintain, which will keep your hold files in place and dedicated to the user.
JG
November 14, 2005, 12:39 PM
Victorov
Thanks for reply
JG: If I understand correctly, data will be saved the same request only, i.e. if user press button 'PDF', and another fex will run (or the same one, but with different parameters), another request wiil be issued, hence saved data will not be available?
Francis: I'm not sure if I can get session id as variable, but if it's possible I see a problem with cleanup: normally server will remove files when session ends. Is it possible to determine when files could or should be deleted?
Thanks
Victorov
November 14, 2005, 12:48 PM
Francis Mariani
You will need a clean-up routine. It could be Report Caster, a Windows Server utility or a UNIX utility.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 14, 2005, 02:10 PM
Victorov
I see. I thought that temp directory associated with session, in this case it could be possible. I'll evaluate solution with external clean-up utility, if it's feasible.
Victor
November 14, 2005, 09:44 PM
TexasStingray
Try using individual user hold directories along with the APP PREPEND command. to pre pend the users own directory onto the app path.
Scott
November 15, 2005, 10:17 AM
Victorov
Is IBIC_user available inside procedure? Is there SessionID variable? I can see a problem if user opens two sessions and run the same reports with different parameters.
December 02, 2005, 12:17 PM
susannah
i have the following line added to my site.wfs on the client IBIMR_user(PASS) in file {}:\ibi\client52\wfc\etc\site.wfs That line addition, it seems, allows me to reference a variable from any of my fexes, eg: -TYPE &IBIMR_user which will contain the user login. I think when a .wfs is edited, you have to restart something to make it effective, but i can't quite recall;
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 02, 2005, 12:31 PM
Victorov
What if user have more then one instance of browser open on the same report but with different parameters? It will be same userid and fex name, but different data. I think combination of sessionid and fex should be used. I understand it will require external cleanup utility, but I can't see anything better. If so, is there any way to get session id inside fex?
Thanks
December 02, 2005, 01:11 PM
susannah
yes use the TEMPPATH command
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 02, 2005, 02:21 PM
Victorov
Great, this should work. I'll try it again later
December 13, 2005, 11:46 AM
Victorov
After I put code in place and made it work I realized it just won't work, TEMPPATH points to agent's temp directory. Agent could be changed between requests and also it might serve different sessions/users. Variable &IBIMR_user is not enough, user might have more then one instance of browser open at the same time. Session id should work, but is it possible to get it inside fex? If not, random number generator might work, but it looks like overkill.
Victor make a directory for each user copy a final hold file (carefully named) into that user's directory. You'ld have to make sure that the master for that hold file was on the path. so you'ld have to tightly standardize your file and nameing conventions. and each night, perhaps, loop thru all your user directories and erase *.* The temppath name is the same as the tscom id, if you look at the server console. i would recommend not using filedef holdmast Were you to direct it to the users directory, it would copy way too much stuff. imho, i would copy only the final extract file, and if you have, say, a certain fexname (eg invex01.fex) that creates a certain extract file (say, hinvex01.ftm) then you can put the master for that standardized extract file into yourpath, and every user would than have access to their own extract file, using that standard master, provided that you filedef it at the beginning of the fex, and check its existence. I use CMD STATE D:\IBI\..\{userdir}\hinvex01.ftm -RUN -IF &RETCODE NE 0 GOTO createit; so..if the file doesn't exist, then branch to thepart of your program that creates it. If it does exist, then filedef it, and branch to the part of your program that reads it.This message has been edited. Last edited by: susannah,
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 13, 2005, 02:28 PM
Victorov
User-specific directory is not enough - user might have more then one open session. The best id should be browser session id. Here is another solution, using random generated id. It's overkill, as I said, but should work. In this case, I'll have to run external clean-up. It's not necessary if you use user id, temp dir size will be limited (it could be huge though). Anyway, it not a final code, but I tested it a little bit:
-* -*-DEFAULT &SID = 942195 -DEFAULT &SID = -1 -SET &OLD_SID = &SID; -* -SET &CI_TEMP = 'd:\ibitemp\'; -SET &FNAME = 'h_chdl'; -SET &TPATH = TEMPPATH (80, 'A80'); -* -IF &SID GT -1 GOTO CHECK_DIR; -* -* Generate new SID -* -SET &SID = RDUNIF ('D6.2') * 1000000; -TYPE SID - '&SID' -* -CHECK_DIR -* -SET &HOLDDIR = &CI_TEMP | &SID | '\'; -TYPE HOLDDIR - &HOLDDIR -* -* Check if Directory already exists -* -SET &DIR_EXISTS = 0; -* -SET &DLIST = &CI_TEMP | &SID |'.txt' ; DOS DIR /A /B &CI_TEMP > &DLIST FILEDEF INPUT DISK &DLIST -RUN -LOOP -READ INPUT, &DATA -IF &IORETURN NE 0 GOTO CONT_DIR; -IF &DATA NE &SID GOTO LOOP; -* -SET &DIR_EXISTS = 1; -* -CONT_DIR -* DOS del &DLIST -* -IF &DIR_EXISTS EQ 1 GOTO DIR_CREATED; -* -TYPE Create &HOLDDIR DOS mkdir &HOLDDIR -* new directory created - make sure report will be rerun -SET &OLD_SID = -1; -* -DIR_CREATED -* -* could not make HOLDMAST work - copy master files instead -* -SET &DATFILE = &HOLDDIR || &FNAME || '.ftm'; -SET &MASSRC = &TPATH || &FNAME || '.mas'; -SET &MASDEST = &HOLDDIR || &FNAME || '.mas'; -* -*FILEDEF HOLDMAST DIR &HOLDDIR FILEDEF H_CHDL DISK &DATFILE -* -* -* should not go there yet, make sure file exists first -* -SET &DATFILEMAME = &FNAME || '.ftm'; -SET &FILE_EXISTS = 0; -* DOS DIR /B &DATFILE > &DLIST FILEDEF INPUT DISK &DLIST -RUN -* -LOOP_FILE -READ INPUT, &DATA -* -IF &IORETURN NE 0 GOTO CONT_FILE; -IF &DATA NE &DATFILEMAME GOTO LOOP_FILE; -* -SET &FILE_EXISTS = 1; -* -CONT_FILE -* DOS del &DLIST -* -IF &FILE_EXISTS EQ 1 GOTO DATA_READY; -* -TYPE rerun report -* -* Retreive data -* TABLE FILE H_TMP PRINT * ON TABLE HOLD AS H_CHDL FORMAT ALPHA END -* -TYPE copy /a /y &MASSRC &MASDEST DOS copy /a /y &MASSRC &MASDEST -* -DATA_READY -* -TYPE DOS copy /a /y &MASDEST &MASSRC DOS copy /a /y &MASDEST &MASSRC -* TABLE FILE H_CHDL PRINT * END -* -*
December 13, 2005, 02:35 PM
susannah
so many ways to do anything you need; that's whats so great about focus.
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID