Focal Point
Auto Prompt from a Hold File (OLAP)

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

February 23, 2007, 04:47 PM
slfmr
Auto Prompt from a Hold File (OLAP)
When using the following auto prompting code:

WHERE COUNTRY EQ &COUNTRY.(FIND COUNTRY IN CAR).Select Country.

I am finding it difficult to do the same thing with a HOLD file.

For example doing:

TABLE FILE CAR
PRINT COUNTRY
ON TABLE HOLD AS HOLD1
END


TABLE FILE EARLIER_HOLD_FILE
PRINT
NAME
BIRTHDATE
COUNTRY
WHERE COUNTRY EQ '&COUNTRY.(FIND COUNTRY IN HOLD1).Select Country.'

I realize I can just say find country in car since there is a master file to do that, but this is just an example of how I need to refer to a hold file and pull those values from there.

Is this possible.. as a whole the following doesn't work:

-OLAP ON

TABLE FILE CAR
PRINT COUNTRY
ON TABLE HOLD AS HOLD1
END

OLAP DIMENSIONS
CAR: CAR;
COUNTRY: COUNTRY;
END

TABLE FILE CAR
PRINT CAR
COUNTRY
WHERE COUNTRY EQ &COUNTRY.(FIND COUNTRY IN HOLD1).Select Country.
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET AUTODRILL ON
ON TABLE SET OLAPPANE TOP
ENDSTYLE
END

And I would need that to work to do what I am trying to do... populate the drop down from a hold file. I have been through posts and the HELP and have tried FILEDEF, APP HOLD, CREATE FILE etc.. and nothing is working... I am sure I may be doing something wrong .. can anyone help?

Thank you in advance!


Dev, SIT, UAT, Production:7.6.6
Dev Sandbox:7.6.11

Dev Studio - 7.6.6
February 23, 2007, 05:00 PM
Prarie
Try this...and then make sure the .foc file and Master are created.

ON TABLE HOLD AS HOLD1 FORMAT FOCUS


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
I believe that what you are trying to achieve is not possible using the approach you have.

Basically using autoprompt will be running 3 sessions. First, pick out the autoprompt requirements, as far as I am aware no report is run. Second load the autoprompt page and collect the required data. Third, run report after the auoprompt, when the hold file will actually be run.

Each of these is a seperate session with no knowledge of the previous/subsequent sessions, so a hold file, actually created in the 3rd session cannot be referenced in the 2nd session.

Creating a permanent/semi-permanent file, so it is accessible from each session would be required I think.


Alan.
WF 7.705/8.007
That is also my understanding Alan, it's a bit like DM in as much that the auto prompting is resolved before any report, therefore the FILE refered to within the prompting code HAS to exist if slfmr wants it to function in the manner suggested.

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 
I have a question to Tony and Alan: would putting a -RUN behind the code that builds HOLD1 ensure that HOLD1 is built before attempting the next piece of code? Like this:

TABLE FILE CAR
PRINT COUNTRY
ON TABLE HOLD AS HOLD1
END
-RUN

TABLE FILE EARLIER_HOLD_FILE
PRINT
NAME
BIRTHDATE
COUNTRY
WHERE COUNTRY EQ '&COUNTRY.(FIND COUNTRY IN HOLD1).Select Country.'


Data Migrator 5.3, 7.1, 7.6
WebFOCUS 7.1, 7.6, 7.7
SQL Server, Oracle, DB2
Windows
No Jessica,

It's not a case of building code like that, it's the approach taken by autoprompt, correct in my opinion, that will stop what you require happening.

When you have autoprompt on, the code is parsed for variables, in your example it finds:

&COUNTRY.(FIND COUNTRY IN HOLD1).Select Country.

then it builds the prompt screen, at which time it then runs:

FIND COUNTRY IN HOLD1

basically a TABLE request against HOLD1, but HOLD1 does not exist, and so the autoprompt fails to find values to use to populate the select.

It is only after a succesful autoprompt session, that the actual report is run, and at that stage would the file HOLD1 be created.

If the approach you wanted autoprompt to take were to work, how does automprompt really know what to run and when, it would be quite complex thing to achieve.

This is a case where hand-coded user intervention is really the only solution. At Susannah's request I am writing an article for Focal Point which will cover these exact issues.


Alan.
WF 7.705/8.007
Actually on that note, a new feature request could be:

&COUNTRY.(EXEC focexecName(parameter1,parameter2)).Select Country.

where the output of the focexec would be, presumably, an ON TABLE HOLD FORMAT XML. Parameter1/2 could be populated &variables, passed through to the host focexec, and passed through to the EXEC'ed focexec.

This would give a lot of control over the select population, and from what I can see would not take a lot to implement, and would give slfmr what he wants.

Anyone agree?


Alan.
WF 7.705/8.007
Jessica,

Exactly as Alan says.

From your comment regarding the -RUN, you obviously understand the order in which components are executed, so think of the execution process as -

Auto Prompt
Dialogue Manager
FOCUS code

slfmr,

Don't forget thet you can code a where in the FIND as well -
WHERE MODEL EQ &Model.(FIND MODEL IN CAR WHERE COUNTRY EQ '&Country').Select Model.

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 
slfmr ,

Alan and Tony are right. What you're trying to do will never work with auto prompt. It's like Alan said; WF will first try to find all the unresolved amper variables and then creates the html screen. At this point no fex or part of a fex has been executed. So the HOLD1 file that you want to use to fill a dropdown list does not exist at this point. Since the auto prompt will never solve your problem, I strongly suggest that you create your own html screen.

You can find a number of examples on how to do this in the WF documentation.

Hope this helps,
SLFMR,

Here is een example:
-* File IBIFIL_HTML.fex
-SET &ECHO=ALL;
DEFINE FILE CAR
OPTCOUNTRY/A100 = '<option value ="' || COUNTRY ||'">'|| COUNTRY || '</option>';
END
TABLE FILE CAR
SUM OPTCOUNTRY
BY COUNTRY NOPRINT
ON TABLE HOLD FORMAT ALPHA AS HOLD1
END
-RUN

-HTMLFORM BEGIN
-*

<HTML>
<TITLE> DYNAMIC DROP-DOWN LIST REPORT </TITLE>
<H4> CARS BY COUNTRY </H4>
<FORM ACTION="/ibi_apps/WFServlet" METHOD="GET">
<INPUT TYPE="HIDDEN" NAME="IBIF_ex" VALUE="IBIFIL_REPORT">
<SELECT NAME="COUNTRY" SIZE="3" MULTIPLE>
!IBI.FIL.HOLD1;
</SELECT>
<BR>
<BR>
<INPUT TYPE="SUBMIT" VALUE="RUN REPORT">
</FORM>
</BODY>
</HTML>
-*

-HTMLFORM END


-* File ibifil_REPORT.fex
-OLAP ON
-SET &ECHO = ALL;
-SET &COUNTER=1;

OLAP DIMENSIONS
CAR: CAR;
COUNTRY: COUNTRY;
END

TABLE FILE CAR
PRINT
CAR
BY COUNTRY
-IF &COUNTRY.EXISTS NE 1 THEN GOTO LOOP1;
WHERE COUNTRY EQ '&COUNTRY'
-GOTO OUTLOOP
-LOOP1
WHERE COUNTRY EQ '&COUNTRY.&COUNTER'
-IF &COUNTRY0.EXISTS NE 1 THEN GOTO OUTLOOP;
-REPEAT OUTLOOP FOR &COUNTER FROM 2 TO &COUNTRY0;
OR '&COUNTRY.&COUNTER'
-OUTLOOP
;
-DONE
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET AUTODRILL ON
ON TABLE SET OLAPPANE TOP
END

IBIFIL_HTML.fex will create the HOLD1 file that contains all countries that can be selected in the drop downlist. The !IBI.FIL.HOLD1; command will dynamicly populate the dropdown list. ibifil_REPORT.fex will produce the report for the countries that haven been selected.
This example will run in WF 7.1.X. Also make sure that the prompting for parameters is set to off.

Remark: Please update your profile (signatur) so we know which version you are running. It will be easer for people to help you if they know what version you're running

Let me know if you still have questions

This message has been edited. Last edited by: <JJI>,
As I was trying to create some examples last night, I found that the following may work with auto-prompt:
-OLAP ON
-IF &COUNTRY.EXIST GOTO :NOPROMPT;
TABLE FILE CAR
PRINT COUNTRY
WHERE COUNTRY EQ &COUNTRY.(FIND COUNTRY IN CAR).Select Country.
END
-:NOPROMPT
OLAP DIMENSIONS
CAR: CAR;
COUNTRY: COUNTRY;
END

TABLE FILE CAR
PRINT CAR
COUNTRY
WHERE COUNTRY EQ &COUNTRY
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET AUTODRILL ON
ON TABLE SET OLAPPANE TOP
ENDSTYLE
END


Though I am sure that what you want in reality may be better achieved by using the method shown by Dirk JJI above.

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
Thanks for all the feedback! I tried the FORMAT FOCUS before posting as well as a million other things, and assumed it was impossible because of steps auto prompt actually takes. I did want to be sure though which is why I posted.

I do support for some groups in my company and they came across this and were wondering if it were possible. I tried a few things then posted and now I know for sure it does not work.

I can definitely guide in creating their own front end if needed.

Again, thanks so much for your help!!


Alan I liked your idea about &COUNTRY.(EXEC focexecName(parm1, parm2)).Select Country.

I think that would definitely be a good add!


Dev, SIT, UAT, Production:7.6.6
Dev Sandbox:7.6.11

Dev Studio - 7.6.6