Using Amper Variable in an Find In statement [SOLVED]
Hi Guys, firstly i apologise if ive asked this before- ive searched the forum for a post i may have already made about this but couldn't find anything.
What im trying to do is use a
FIND FILENAME IN
statement but use an amper variable as the data source.
Knowing that there is a certain order to how DM is processed ive actually populated the variable in the preceding report.
basically it wont accept the use of a variable, if i enter the string content of the variable it works but as that content will change depending parameters selecting in the preceding fex i need to use a variable rather than static string....
SO THIS:
FIND FILENAME IN &SOURCE
INSTEAD OF THIS:
FIND FILENAME IN FLATFILE
i would expect it to fail if the variable was being assembled in the same fex as it would probably build the &dummy statements first (?)
but i expected it to work when the variable alreday exists...
ive tried putting the variable in single quotes- other than that i can't think of anything else to try
anyone know why this isn't possible?This message has been edited. Last edited by: nubi,
Developer Studio 7.64 Win XP Output: mostly HTML, also Excel and PDF
"Never attribute to malice that which can be adequately explained by stupidity." - Heinlein's Razor
December 18, 2008, 09:49 AM
Francis Mariani
You may simply be missing a -RUN after the END statement of the TABLE FILE statement. It is required if you're using Dialogue Manager to alter the WebFOCUS code.
FILEDEF TEST1 DISK TEST1.TXT
-RUN
-WRITE TEST1 ENGLAND
-WRITE TEST1 FRANCE
FILEDEF TEST2 DISK TEST2.TXT
-RUN
-WRITE TEST2 ITALY
-WRITE TEST2 JAPAN
-SET &SOURCE = IF EDIT(&TOD,'$$$$$$99') GT 30 THEN 'TEST2' ELSE 'TEST1';
TABLE FILE CAR
PRINT
*
HEADING
"&TOD"
WHERE COUNTRY IN FILE &SOURCE
END
-RUN
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
December 18, 2008, 10:14 AM
nubi
Hi Francis
thanks for the reply
sorry i wasn't clear in my code examples in my atgtempt to keep my post short...
the FIND statement is actually part of a 'SET &DUMMY' statement
Such as:
-SET &DUMMY = &COUNTRY.(FIND COUNTRY IN CAR).Enter Table 1.;
TABLE FILE CAR
PRINT *
WHERE COUNTRY EQ '&COUNTRY'
END
inbstead what im trying to do is this:
-SET &DUMMY = &TABLE1.(FIND TABLE IN &VARIABLE).Enter Table 1.;
TABLE FILE &TABLE1
PRINT *
END
where &VARIABLE is a list of tables, as i sya it works when the source is not an amper variable....which is no good for my needs.
i have eneterd a -RUN after everything as suggested but there has been no change.
im not even sure its possible but given the flexibility of WF it's just as likely that it is possible but involves syntax im unaware of...
cheers
Developer Studio 7.64 Win XP Output: mostly HTML, also Excel and PDF
"Never attribute to malice that which can be adequately explained by stupidity." - Heinlein's Razor
December 18, 2008, 10:24 AM
Tony A
Nubi,
I guess that you are using Amper Autoprompting? In which case the variable won't be avaiable at the point during which the dynamic combo box is built for &COUNTRY in your example.
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
December 18, 2008, 10:26 AM
Francis Mariani
Please try adding .EVAL.
quote:
The .EVAL operator enables you to evaluate a variable's value immediately, making it possible to change a procedure dynamically. The .EVAL operator is particularly useful in modifying code at run time
We don't use this prompting method, so my sample code does not run on our server, but I think the syntax is correct.
-SET &VARIABLE = 'CAR';
-SET &DUMMY = &TABLE1.(FIND TABLE IN &VARIABLE.EVAL).ENTER TABLE 1.;
TABLE FILE &TABLE1
PRINT *
END
-RUN
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
December 18, 2008, 10:27 AM
Francis Mariani
Tony's answer renders mine moot.
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
December 18, 2008, 10:46 AM
nubi
thanks Francis and Tony,
that makes sense, a new fex will render any auto-prompt variables before recognising those which already have a value...
good to know, ill try a different method
thanks
Developer Studio 7.64 Win XP Output: mostly HTML, also Excel and PDF
"Never attribute to malice that which can be adequately explained by stupidity." - Heinlein's Razor