Focal Point
[SOLVED] Prompt

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

May 05, 2006, 03:48 PM
Foccrawler
[SOLVED] Prompt
I have a question on a -PROMPT where the supplied variables are themselves amper variables. This is something I am transplanting from Windows (Desktop) Focus to WebFOCUS.
Specifically this is the line of code in question:
-PROMPT &FULLFY.(&THISFY.EVAL, &LASTFY.EVAL).VERIFY CURRENT FY.

Have been following this with -SET &ECHO=ALL; so I can review.
What is happening is that I do get a prompt window. But what I am prompted for in the drop-down is
&THISFY.EVAL
&LASTFY.EVAL
...instead of their resolved values which should be in this case,
2005
2006
---
So to get the thing to just run so I can look at the echo'd commands I'll just select &THISFY.EVAL
Immediately below the -PROMPT I have a
-TYPE &FULLFY is &FULLFY.EVAL
-EXIT

Okay, on the results I see that both &THISFY and &LASTFY are resolved just fine.
When it gets to the -PROMPT is reads:
-PROMPT &FULLFY.(2006, 2005).VERIFY CURRENT FY.
In response to my -TYPE I get
-TYPE &THISFY.EVAL IS 2006
-----
So, what is going on? Am I doing the impossible? Is it because the request has not yet gone to the WF Reporting Server when I get the prompt box, that it cannot resolve &THISFY and &LASTFY? Then finally the obvious question, "Is this doable?"

Thanks for your insight!

This message has been edited. Last edited by: Kerry,
May 05, 2006, 04:46 PM
Prarie
Where is 2005 and 2006 coming from?


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
take the .EVAL out of the prompt




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
To answer both questions in reverse order:

I have tried running this without the .EVAL's and the result is the same...of course with the exception that the drop-down now displays &THISFY and &LASTFY. Also same as in above scenario, if I select &THISFY the run resolves okay and the &ECHO report clearly reveals &THISFY resolved as 2006. So the whole problem is relatively cosmetic except that we want to see 2006 not &THISFY in the drop-down.

Prarie - The 2005 and 2006 are coming from dialogue manager statements as follows:
-SET &CURMN=EDIT(&YYMD, '$$$$99$$') ;
-SET &THISYR=EDIT(&YYMD, '9999$$$$') ;
-SET &THISFY=IF &CURMN GE 07 THEN &THISYR.EVAL + 1 ELSE &THISYR.EVAL ;
-SET &LASTFY = &THISFY.EVAL - 1 ;

Incidentally I have also tried removing the .EVAL's here too without any success.
Bill
[Bill,

I think the important question here is in what context are you trying to use the prompt. This is especially relevant as (in version 5.3.2) there is no longer an equivalent of PROMPT in the manner you specify.

So, we know it's on windows. Is it a maintain app (alt to MODIFY), normal HTML front end, combo box on a report?

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 
Tony,
The useage of the variables here is in the TABLE environment, or more specifically in MATCH. That is to determine which 2 filenames to look at (this FY and last FY).
As an aside I know it may seem obvious but things get blurry around FY turnover time as to exactly what is what. Our FY closeout gets dragged into July each year.
Bill
HI BILL (FOCCRAWLER) - DID YOU EVER GET THIS WORKING ? I have a similar issue and have not been able to sort it out.


_______________________
*** WebFOCUS 8.1.05M ***
Ian,

It may be best if you explain your 'similar issue' in a bit more detailed fashion.
If it is the same as this old one, then it will never work like this - the autoprompt parser is run BEFORE the reporting server ever gets to do something, so it can not possible know of the variable values, and hence it will never perform the variable replacements.
What you could do in such a case is to present a self-made htmlform to the user where you ask the question as opposed to an automatically generated one which in these cases will just not work the way you want it to work.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
I would also be careful to pay attention to the dates on the posts. The versions in use at the time of this post (2006) were in the 4.3.6 to 5.3.X range and behavior in earlier versions could be (and are!) drastically different.

There are also many different ways to get what you're looking for, like dynamic calendar controls, instead of using -PROMPT. In my opinion, that is "old" syntax. (I'm not inferring that those who still use it are old. Smiler )

As GamP says, maybe if you explained your exact issue, we could help you out. Also, please refer to the sections in the documentation about using &variables and the .EVAL operator. Many informative posts on the forum as well.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
Hi Ian,

What platform and version are you running on now-a-days? (I think you were on Z/OS last time we comversed?), and where are you attempting the prompt - HTML form etc.

Regards

Tony



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 
Thannks to all of the above who have commented. What I am trying to do is shown below (ignore the fact that CAR field is not a date !!) :-

-TYPE &YYMD
-RUN
-DEFAULT &CAR = &YYMD.EVAL
-RUN
-TYPE &CAR
-RUN
TABLE FILE CAR
PRINT MODEL
BY COUNTRY
BY CAR
WHERE CAR EQ '&CAR' ;
END
-EXIT

It refuses to resolve &CAR to today's date.
I have IBIF_wfdescribe set to XMLPROMPT


_______________________
*** WebFOCUS 8.1.05M ***
Which would be a correct observation.
See my previous post:
quote:
it will never work like this - the autoprompt parser is run BEFORE the reporting server ever gets to do something, so it can not possible know of the variable values, and hence it will never perform the variable replacements.

Autoprompt will only scan the fex searching for any unresolved (read: not initialized with -SET) variables. It won't run it to see if anything is unresolved....


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
... and therefore you cannot default a variable to another variable value Frowner

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 
... when using autoprompt. If you're not using autoprompt you can.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
I do need to prompt the users for a date - ideally via dynamic calendar control as Darin Lee mentioned above. Any suggestions ?


_______________________
*** WebFOCUS 8.1.05M ***
This works for me:

-SET &DT1 = 20091205;

-TYPE &YYMD

-DEFAULT &DT1 = &YYMD.EVAL;

-TYPE &DT1

DEFINE FILE EMPDATA
NEWHIREDATE/YYMD = DATEADD(HIREDATE, 'Y', 19);
END
-RUN

TABLE FILE EMPDATA
PRINT
SALARY
NEWHIREDATE 
BY LASTNAME
BY FIRSTNAME
WHERE NEWHIREDATE GE '&DT1' ;
END
-RUN


I do not have auto-prompting turned on.

In the example above, the default date is today, but I am testing for 2009/12/05. That line can be commented to use today's date instead.

The date can be delivered to the fex via an HTML launch page that contains a select-box or calendar control.


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
Just to add to Francis' advice, when a client "mandates" the autoprompter, I do the following to create a year database and do FIND to populate the listbox:

Create a MASTER in BASEAPP called PROMPT_YRS:

 
FILENAME=PROMPT_YRS, SUFFIX=FOC,$
SEGNAME=TOP, SEGTYPE=S1,$
 FIELDNAME=YEAR   , , FORMAT=I4,  $

then:
  
-SET &ECHO=ALL;
-SET &YEAR0 = 0;
-SET &YEAR1 = 0;
-SET &YEAR2 = 0;
-SET &YEAR3 = 0;
-SET &YEAR4 = 0;
-SET &YEAR0 = EDIT(&DATEYYMD,'9999');
-SET &CNTR = 1;
-REPEAT  GET_YRS 4 TIMES
-SET &YEAR.&CNTR = &YEAR0 - &CNTR;
-TYPE &YEAR.&CNTR
-SET &CNTR = &CNTR + 1;
-GET_YRS
APP HOLD BASEAPP
CREATE FILE PROMPT_YRS
-RUN
MODIFY FILE PROMPT_YRS
FREEFORM YEAR
MATCH YEAR
ON MATCH REJECT
ON NOMATCH INCLUDE
DATA
&YEAR0.EVAL,$
&YEAR1.EVAL,$
&YEAR2.EVAL,$
&YEAR3.EVAL,$
&YEAR4.EVAL,$
END
-RUN

DEFINE FILE EMPDATA
NEWHIREDATE/YY = DATEADD(HIREDATE, 'Y', 19);
END
TABLE FILE EMPDATA
PRINT
    SALARY
    NEWHIREDATE
  BY LASTNAME
  BY FIRSTNAME
WHERE NEWHIREDATE EQ '&SEL_YEAR.(FIND YEAR IN PROMPT_YRS).Select Year.'
END
-RUN


A quick way to do current year minus whatever with amper variables...

hth

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
OR

Create a -PROMPT fex in an APP folder, BASEAPP for this, called prompt_yrs.fex, and hard-code:

  
-PROMPT '&SEL_YRS.(<2009,2009>,<2008,2008>,<2007,2007>).Select Year.'

then
  

-MRNOEDIT -INCLUDE baseapp/prompt_yrs.fex

DEFINE FILE EMPDATA
NEWHIREDATE/YY = DATEADD(HIREDATE, 'Y', 19);
END

TABLE FILE EMPDATA
PRINT
    SALARY
    NEWHIREDATE
BY LASTNAME
BY FIRSTNAME
WHERE NEWHIREDATE EQ &SEL_YRS;
END
-RUN


Then change 1 program once a year...

Flexible WebFOCUS!!!!


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
Hi Francis, Thanks for your comments however I tried what you suggested and the prompt doesn't appear as &DT1 has been resolved. The best way is I beleive to do the following workaround which is a follows:-
Go into EDASPROF (ibi\srvnn\wfs\etc\edasprof.prf) and add:
FILEDEF DEFAULT DISK DEFAULT.FEX
-RUN
-WRITE DEFAULT -DEFAULT &|DATE='&YYMD'

In the focexec add:
-INCLUDE DEFAULT
TABLE FILE CAR
PRINT MODEL
BY COUNTRY
BY CAR
WHERE CAR EQ '&DATE' ;
END
-RUN

This works well.


_______________________
*** WebFOCUS 8.1.05M ***
Hi Tom, Thanks for your suggestions too. Your idea is fine when it's the year only that is being prompted for as you only need to change this annually. If it's yymmdd that you need to change it daily !! See above for the best workaround (unless anyone has a better idea !!). Cheers.....


_______________________
*** WebFOCUS 8.1.05M ***
quote:
It refuses to resolve &CAR to today's date.
I have IBIF_wfdescribe set to XMLPROMPT


With XMLPROMPT (as opposed to XMLRUN), that's what it should do: Prompt for any variables w/o -SET, even if they have -DEFAULT values.

Try putting

-SET &CAR=&CAR;

after the -DEFAULT -- that may be enough to convince the pre-scan to exclude it from autoprompting.


- Jack Gross
WF through 8.1.05
Sorry Jack - your suggestion made no difference.


_______________________
*** WebFOCUS 8.1.05M ***
Perhaps a similar suggestion by Jack might help...


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