As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
Hello everybody, Please take a look at the following:
WHERE COMPANY_CODE EQ &COMPANY
-IF &COMPANY0.EXISTS NE 1 THEN GOTO NOMULSELCOM;
-REPEAT NOMULSELCOM FOR &COUNTER FROM 2 TO &COMPANY0;
OR '&COMPANY.&COUNTER'
-NOMULSELCOM
This code is supposed to retrieve values from the select dropdown in both case - when there is only one value passed and when there are more then one company selected. Default for the COMPANY is '$*', which should run report for all companies. And it does not. I get the following error:
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: $
I tried to put &COMPANY in quotes
WHERE COMPANY_CODE EQ '&COMPANY'
Then I get
(FOC280) COMPARISON BETWEEN COMPUTATIONAL AND ALPHA VALUES IS NOT ALLOWED
COMPANY_CODE is I4 data type.
What am I doing wrong? Thank youThis message has been edited. Last edited by: Evgenia,
Skip the test entirely when the user selects 'all'. Assuming that's the topmost option, it would be the first selection:
-IF &COMPANY EQ '$*' GOTO -NOMULSELCOM; WHERE COMPANY_CODE EQ &COMPANY -IF &COMPANY0.EXISTS NE 1 THEN GOTO NOMULSELCOM; -REPEAT NOMULSELCOM FOR &COUNTER FROM 2 TO &COMPANY0; OR '&COMPANY.&COUNTER' -NOMULSELCOM
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
-IF $* EQ '$*' GOTO -NOMULSELCOM;
0 ERROR AT OR NEAR LINE 45 IN PROCEDURE drillordFOCEXEC *
(FOC281) ALPHA ARGUMENTS IN PLACE WHERE NUMERIC ARE CALLED FOR
OK, it works. But there is a problem with semantics. Both, for all companies and for a single one the code:
-IF &COMPANY EQ '$*' GOTO NOMULSELCOM;
WHERE COMPANY_CODE EQ &COMPANY
-IF &COMPANY0.EXISTS NE 1 THEN GOTO NOMULSELCOM;
-REPEAT NOMULSELCOM FOR &COUNTER FROM 2 TO &COMPANY0;
OR '&COMPANY.&COUNTER'
-NOMULSELCOM
works fine. Here is the echo when single company is selected:
-IF 001 EQ '$*' GOTO NOMULSELCOM;
WHERE COMPANY_CODE EQ 001
-IF NOT 0 THEN GOTO NOMULSELCOM;
-NOMULSELCOM
Here &COMPANY has 001 in it.
But then with multiselect the following code where I also test if multiselection exists:
-IF &COMPANY0.EXISTS THEN GOTO X2;
-TYPE 'COMPANY VALUE IS &COMPANY'
-GOTO SKIPIT3
-X2
-TYPE 'COMPANY0 VALUE EXISTS AND IS &COMPANY0'
-SKIPIT3
-IF &COMPANY EQ '$*' GOTO NOMULSELCOM;
WHERE COMPANY_CODE EQ &COMPANY
-IF NOT &COMPANY0.EXISTS THEN GOTO NOMULSELCOM;
-REPEAT NOMULSELCOM FOR &COUNTER FROM 2 TO &COMPANY0;
OR '&COMPANY.&COUNTER'
-NOMULSELCOM
produces echo:
-IF 1 THEN GOTO X2;
-X2
-TYPE 'COMPANY0 VALUE EXISTS AND IS 2'
'COMPANY0 VALUE EXISTS AND IS 2'
-IF $* EQ '$*' GOTO NOMULSELCOM;
-NOMULSELCOM
My understanding is that &COMPANY in the case of multiselect retains the default value of '$*' and that is why the loop is not executed.
I tried to trick it with:
-IF &COMPANY EQ '$*' AND NOT &COMPANY0.EXISTS GOTO NOMULSELCOM;
WHERE COMPANY_CODE EQ &COMPANY
-IF NOT &COMPANY0.EXISTS THEN GOTO NOMULSELCOM;
-REPEAT NOMULSELCOM FOR &COUNTER FROM 2 TO &COMPANY0;
OR '&COMPANY.&COUNTER'
-NOMULSELCOM
But it comes back with '(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: $' error.
I thought with multiselect &COMPANY is the same as &COMPANY1???
If you select more than one item in multiselect list then the amper variable by the name name of the list does not exist when the form is posted. i.e in your case If you select only one value then &COMPANY exists If you select more than one value then &COMPANY0 contains howmany values are selected. ANd individual values will be &COMPANY1 etc., However &COMPANY value does not exists at all.
Your case seems to be like you have defined a default value -DEFAULTS &COMPANY='$*';
And so when you select more than one value Both parts of the statement -IF &COMPANY EQ '$*' AND NOT &COMPANY0.EXISTS GOTO NOMULSELCOM; pass the test and you get to WHERE COMPANY_CODE EQ $*
AS j.g. has mentioned you cannot use $* for numeric field comparisions.
Posts: 38 | Location: India | Registered: May 18, 2005
Tony, thanks for info. I am on 7.1.3, so now wonder my vision is obscured!!!
Anyhow for the current problem the If clauses should be little refined.
-IF NOT &COMPANY0.EXISTS GOTO SINGLESELECT -* multi select code here WHERE COMPANY_CODE EQ &COMPANY1 -REPEAT MULSELCOM FOR &COUNTER FROM 2 TO &COMPANY0; OR &COMPANY.&COUNTER -MULSELCOM -GOTO ENDCLAUSE
-SINGLESELECT -IF &COMPNAY EQ '$*' THEN GOTO ENDCLAUSE; WHERE COMPANY_CODE EQ &COMPANY -ENDCLAUSE
Posts: 38 | Location: India | Registered: May 18, 2005
Why bother using '$*' for all values when there is a perfectly good internal value of 'FOC_NONE' for this situation (depending upon your release of course). The advantage of using 'FOC_NONE' is that WebFOCUS will ignore lines where 'FOC_NONE' is in the selection or a field name ..
e.g.
-SET &ByField = 'FOC_NONE'; TABLE FILE CAR SUM RCOST DCOST BY COUNTRY BY &ByField WHERE &ByField EQ 'ENGLAND' END
will ignore both the BY &ByField and the WHERE clause.
In addition, if, when you create your SELECT, you choose to add the all option, WebFOCUS will insert the value 'FOC_NONE' when the all option is selected and therefore you have less worries.
You could extend the above code to deal with multiple selects as follows :-
-DEFAULT &COMPANY = 'FOC_NONE' -SET &ByField = 'FOC_NONE'; TABLE FILE CAR SUM RCOST DCOST BY COUNTRY BY &ByField -IF &COMPANY EQ 'FOC_NONE' AND NOT(&COMPANY0.EXISTS) GOTO :EndSelect; -SET &Cnt = IF &COMPANY1.EXISTS THEN '1' ELSE ''; WHERE COUNTRY EQ '&COMPANY&Cnt.EVAL' -IF &COMPANY0.EXISTS EQ 0 THEN :EndSelect; -REPEAT :EndSelect FOR &Cnt FROM 2 TO &COMPANY0; OR '&COMPANY&Cnt.EVAL' -:EndSelect END
Substitute the 'FOC_NONE' in the DEFAULT for 'ENGLAND' to see the results.
Hope this has helped.
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
Thank you very much, guys. I did find a way around it. But I definitely will keep your comments in mind.
Tony, I am a beginner at WebFOCUS trying to develop reports consulting already existent code and modifying it. Sometimes I need to write my own piece, but again, I am learning. Now I know a thing or two about FOC_NONE. Thank you.