Focal Point
[SOLVED]Using SET to create variable

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

March 29, 2010, 11:36 AM
T.Peters
[SOLVED]Using SET to create variable
I am trying to use the SET command in Dialogue Manager to create two variables, StartDate and EndDate that I will use in a number of reports/processes/etc in a process flow. My code currently is:

-SET StartDate = &&StartDate
-SET EndDate = &&EndDate

I get an error that says "(FOC295) A VALUE IS MISSING FOR: &&StartDate." I'm thinking, "Well, yeah, that's the point. I want to SUPPLY the value." So why am I not being prompted to enter a date? I am new to WF, so sorry this is such a basic request. I tried searching these forums, but nothing I can see addresses this.

This message has been edited. Last edited by: T.Peters,


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
March 29, 2010, 11:39 AM
GinnyJakes
You are missing the leading ampersands in front of your -SET variables. It should be:
-SET &StartDate=&&StartDate
-SET &EndDate=&&EndDate

Also the error is in relation to &&StartDate which is a global variable and should have been set prior to the focexec beginning. It cannot be prompted for.

What are you actually trying to do?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
March 29, 2010, 11:47 AM
T.Peters
I want to create two variables that I can use multiple times down the procedure. I am probably going to have 7-8 reports in the stack that all run for the same date range. I will then store the output of these reports into a HOLD file and query all the hold files and combine them into a final report.


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
March 29, 2010, 11:50 AM
njsden
quote:
Well, yeah, that's the point. I want to SUPPLY the value.


The you should have something like:

-DEFAULTS &StartDate =  your_default_start_date_here;
-DEFAULTS &EndDate   =  your_default_end_date_here;


Only if you need those variables to be globally accessed you'd prefix them with a double ampersand.

But to Ginny's point, what exactly do you want to do? That way we can make more informed suggestions leaving the "guess" factor out of the equation.

- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
March 29, 2010, 11:56 AM
njsden
quote:
I want to create two variables that I can use multiple times down the procedure

As long as everything happens within the procedure (by actual code in it or through the use of -INCLUDE) you should be fine by just using &StartDate and &EndDate. Global variables would not be applicable in this case.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
March 29, 2010, 11:56 AM
T.Peters
njsden, I dont really want a DEFAULT parameter to use, I want to prompt the user to input a date that will be globally assigned. I want to reuse that variable in multiple reports.


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
March 29, 2010, 12:02 PM
fatboyjim
Hi,

You can use the following code to force a prompt:

This is for a text field
  
-PROMPT &USERNUM.A9.Please enter your Employee Nubmer


This is for a dropdown
  
-PROMPT &STORECODE.(B10,B20,B30,B40).Please select a Store.


Hope this helps.

Best Regards,

Jimmy Pang


DEV: WF 7.6.10
TEST: WF 7.6.10
PROD: WF 7.6.10
MRE: WF 7.6.4
OS/Platform: Windows
Dev Studio: WF 7.7
Output: HTML, EXCEL, PDF, GRAPH, LOTUS, CSV
March 29, 2010, 12:06 PM
T.Peters
quote:
Originally posted by fatboyjim:
Hi,

You can use the following code to force a prompt:

This is for a text field
  
-PROMPT &USERNUM.A9.Please enter your Employee Nubmer


This is for a dropdown
  
-PROMPT &STORECODE.(B10,B20,B30,B40).Please select a Store.


Hope this helps.

Best Regards,

Jimmy Pang


Jimmy, that looks close to what I'm looking for. When I implement that, though, I get "EDA NO DATA." Is something missing? Should I be pointing to a data source or something?

EDIT: I changed the code to read
-PROMPT &StartDate.'Please enter Start Date(YYYYMM)'.A6
-PROMPT &EndDate.'Please enter End Date(YYYYMM)'.A6

This seems to work, I get the prompt I want and I can enter the date. I still need to see if I can actually USE it now.


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
March 29, 2010, 12:13 PM
GinnyJakes
You really don't need to use the -PROMPT. If the variable appears anywhere in the focexec, it will be prompted for with the autoprompt screen depending on your autoprompt setting in the client console.

In your case, you would want to create a nice launch page with calendar controls for the start and end dates.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
March 29, 2010, 12:16 PM
T.Peters
quote:

In your case, you would want to create a nice launch page with calendar controls for the start and end dates.


Ginny, I thought of doing that too. How can I save the output of the control to the variable?


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
March 29, 2010, 01:05 PM
fatboyjim
Hi,

If that's all in the program, then you will not get anything.
If that is the only thing that you want to do in the program, I suggest making a HTML page displaying a message about parameters saved.

Since you want to use this multiple times, you may want to save it into a file.
I think you can do a -WRITE command (do a search would be best for examples).

-WRITE filename [NOCLOSE] text

  
-WRITE SAVEDPARM &SDATE.A6. &EDATE.A6.


And then you can use the -READ command to extract it back out.
Not sure if this is the best idea or if there are any issues with it, but you can give it a try.

Best Regards,

Jimmy Pang


DEV: WF 7.6.10
TEST: WF 7.6.10
PROD: WF 7.6.10
MRE: WF 7.6.4
OS/Platform: Windows
Dev Studio: WF 7.7
Output: HTML, EXCEL, PDF, GRAPH, LOTUS, CSV
March 29, 2010, 01:36 PM
GinnyJakes
To answer your question, T, about linking the control to the variable, this is something very easy to do with the HTML Composer. Since you already have your focexec written and it has amper variables in it, you will create a new page using the HTML Composer. Once in the tool, add a button to the page. Open the Hyperlink properties. create a reference for the button pointing to an 'external procedure', and point to your program. You can then choose to create or not create a form. I choose the latter. When you close out of that, your controls are automatically put on the page. You can then switch to the parameters view and customize the controls to be dates and they should already be tied to the amper variables in your program.

I think this is what you meant by saving the control output to a var. Please correct me if I'm wrong or if I need to give you more information.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
March 29, 2010, 02:02 PM
T.Peters
So, are you saying create an HTML form completely detached from the procedure stack I'm building and use the button to call the stack using the dates on the calendar control? That makes sense.

When I was trying to do this, I was putting an HTML object inside the stack and trying to figure out how to extract the value from the control.


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
March 29, 2010, 04:32 PM
Waz
I must be getting old...

What do you mean by Procedure Stack ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 29, 2010, 04:40 PM
Francis Mariani
We're all getting old!

I'm just *guessing* the group of entities in the Procedure Viewer is the Procedure Stack???


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
March 29, 2010, 04:47 PM
Waz
Oh Yeah, that makes sense.

Then the post I did to the other thread should be quite easy, all in one fex.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 30, 2010, 10:11 AM
T.Peters
What would be a more "accepted" term for that which would make more sense to the broader community?


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702
March 30, 2010, 10:16 AM
GinnyJakes
Program or focexec for 'procedure stack'. HTML page or launch page for the other. But I knew what you meant. Smiler


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
March 30, 2010, 11:17 AM
T.Peters
quote:
Originally posted by GinnyJakes:
Program or focexec for 'procedure stack'. HTML page or launch page for the other. But I knew what you meant. Smiler


I'll use that in the future then.


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702