Focal Point
Prompting for parameters

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

January 24, 2005, 02:36 PM
<rstull>
Prompting for parameters
I am in the process of trying to develop a report for our customers that would prompt them for an item code, and then produce a report displaying all orders that have that item on it for a predetermined amount of time. I have the framework of the report done, and it works. The problem I�m running into is when I try to include (-Include) an additional file. This file, a customer definition file, is set up so that when a customer logs in, he or she can see only information for their particular account. We�ve used this file in other reports that don�t prompt the user for parameters. However, in the report I am working on now, the user is prompted for parameters that should be supplied by the customer definition file. How can I set it up so that the user is prompted only for the item code? Here is what I have been working on.

-SET &ECHO=ALL;
SET LINES=999999
-INCLUDE CUSTDEF1
-RUN

TABLE FILE SALES

PRINT QTYORD BY PRODNO BY PRODNAME BY SHIPDT BY CUSTNO

ON TABLE HOLD AS HOLD1 FORMAT ALPHA

WHERE ADFLAG EQ 'A'
WHERE SHIPDT GE 20050101

-IF &CUSTPARM.EXIST GOTO IFTEST ELSE GOTO BYTEST;
-IFTEST
WHERE ( CUSTNAME EQ
'&CUSTPARM.CUSTPARM.'
);
-BYTEST
END

TABLE FILE HOLD1

PRINT
PRODNO NOPRINT
PRODNAME AS 'Product'
QTYORD AS 'Quantity Ordered'
SHIPDT AS 'Ship Date'

BY CUSTNO NOPRINT

WHERE ( PRODNO EQ '&PRODNO.Product Code.'
);

END
January 24, 2005, 05:40 PM
<NorthNone>
I've done a lot with variables set in other fexes, but never with a period in the variable, so I'll stay with general comments:
1. What happens if you take the quotes off?
WHERE ( CUSTNAME EQ
&CUSTPARM.CUSTPARM.
);
2. Is there supposed to be a period at the end of
&CUSTPARM.CUSTPARM. ???
3. Can you print the value of the variable set in the other fex?
-TYPE Equals: &CUSTPARM.CUSTPARM
4. Finally, if you store the value of the variable set in the other fex to a new variable, can you print it to screen?
&NEWVAR = &CUSTPARM
-TYPE Equals: &NEWVAR
I wish I had something more specific to offer.
HTH
JSouth
January 24, 2005, 07:59 PM
dhagen
Any parameter that is being explicitly set will not be prompted for. So, I would recommend that you issue a:
-SET &CUSTPARM='anything';
before the -INCLUDE.

I am assuming that &CUSTPARM is being set in the -INCLUDE'd fex.

Let me know if this works for you!
January 25, 2005, 01:31 PM
<rstull>
Thank you both for your suggestions. I'm still somewhat of a novice, so could you tell me what the purpose of issuing the -SET &CUSTPARM is? The &CUSTPARM is set by the -INCLUDEd fex.

Thanks,

Rachel
January 25, 2005, 04:36 PM
dhagen
When WebFOCUS prompts you for a parameter list, it will only prompt you for parameters that haven't been explicitly set. This means that only parms that do not have a -SET will be prompted for. Unfortunately, your version of WF is not parsing the -INCLUDEd focexec. This means that it does not read the -SET in the include, and therefore thinks that it is an unresolved parm.

That might not be that clear!!! Maybe someone else can add to this?
January 25, 2005, 06:40 PM
<NorthNone>
I'm curious as to whether you are able to print the value of the variable set in the other fex when running the original fex:
-TYPE ------------------------------------
-TYPE TYPING OUT THE VALUE OF PARAMETERS
-TYPE FIRST PARAMETER: &CUSTPARM.CUSTPARM
-TYPE SECOND PARAMETER: &CUSTPARM
-TYPE ------------------------------------
Should give you this when you run your fex:
------------------------------------
TYPING OUT THE VALUE OF PARAMETERS
FIRST PARAMETER: (ValueOfParameterAppearsHere)
SECOND PARAMETER: (ValueOfParameterAppearsHere)
------------------------------------
If you do not get values, then you've proved that the -INCLUDE'd fex did not set the values, else you proved that it DID set the values.
If it DID set the values, look to the syntax of your code for the problem.
What version of WebFOCUS are you on?
HTH
JSouth
January 26, 2005, 11:50 AM
<rstull>
Thanks again! I have some time set aside today to work on this, so I'll let you know how it goes. We are running version 5.2.3.

Rachel
January 31, 2005, 07:53 PM
<NorthNone>
Rachel, how are things going?
February 01, 2005, 10:25 AM
<rstull>
Thanks for checking back with me! I am still having issues. I tried using the -SET &CUSTPAR command but that didn't seem to work. I haven't tried your suggestions yet, largely because I am not sure where in the code to put it. I tried to research it in the documentation I have, but I haven't really found any answers yet.
February 01, 2005, 08:24 PM
<NorthNone>
Well, I would put the code to type out the parameters I was looking for just after the -INCLUDE to the fex where you expect those parameters to be set.
February 09, 2005, 11:54 AM
<rstull>
I ended up going another direction with this report. Thanks again for your help!
February 09, 2005, 03:04 PM
<NorthNone>
...and thank you for letting all of us know that you resolved your problem successfully, even if it wasn't the way you'd planned on.