Focal Point
Using Masking with an IF statement...

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

March 28, 2007, 06:43 AM
mark66
Using Masking with an IF statement...
Hi all,

I am trying without success to perform an IF statement with some masking.

The masking works fine when used as part of a WHERE statement, but I am trying to avoid running the query at all if possible:

We have many reports that are named in the convention '_aa_bbbbbbb' that we want to query, but we have some name in the style '_aaaa_bbbbbb' that we do no want to run the query for.

My original query was

TABLE FILE TEST
PRINT *
WHERE REPORT IS '_$$_$*';
WHERE USER EQ 'MARK';
END
-RUN

(There are actually many more WHERE statements but wanted to keep it simple for the example.)

What I would prefer to do is to check if the REPORT is even of the style that I want before running the query. So I have been trying:

-SET &REPORT = '_op_materials';
-IF &PROC NE '_$$_$*' THEN GOTO SKIP_QUERY;

However the mask '_$$_$*' does not match to the variable '_op_materials' like it correctly does in the Where statement.

Is this possible? Any thoughts?


WebFocus 765. iSeries v5r4
March 28, 2007, 10:07 AM
Kerry
Hi Mark,

Can you please try the following code:

DEFINE FILE CAR
FLD1/A12=IF COUNTRY EQ 'ENGLAND' THEN '_aa_bbbbbbb' ELSE
   IF COUNTRY EQ 'JAPAN' THEN '_aaaa_bbbbbb'  ELSE 'ZZZZZZZZZZZZ'; 
END
TABLE FILE CAR
PRINT FLD1
BY COUNTRY
WHERE FLD1 IS '_$$_$*';
END


As for the dialogue manager example:
We do not support MASKing in the conditional IF test. However, the following method may be of interest:
-SET &ECHO=OFF;
-*THIS IS A GOOD ONE
-SET &REPORT = '_op_materials';
-*THIS IS A BAD ONE
-*-SET &REPORT = 'op_materials';
-SET &MYTEST=EDIT(&REPORT,'9$$9');
-IF &MYTEST NE '__' THEN GOTO SKIP_QUERY;
-TYPE  FOUND NEEDED __ , FOUND &MYTEST
-GOTO DONE
-SKIP_QUERY
-TYPE NOT FOUND NEEDED __ , FOUND &MYTEST
-DONE
-RUN
-EXIT


Hope this helps. Big Grin

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
March 28, 2007, 10:16 AM
Tony A
Hi Mark,

Firstly, could you update you signature so we know what release you are using. Thanks.

According to the 7.1.n help files (I had to check Roll Eyes) both WHERE and IF should be acceptable with the mask you are using so I cannot identify why it is not functioning for you. I have got results using both within the CAR file and I even tried defining a new field called REPORT just to see if it baulked at a possible reserved word, but no, it worked fine.

Tested it against Oracle table as well with success.

What DBMS source are you using? WHat response are you getting? What error messages ..... etc.

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 
March 28, 2007, 10:44 AM
mark66
Thanks Kerry, I will give that method a try and let you know how I get on Smiler

Tony, how do I setup my signature - sorry to ask such what should be such a simple question, I have been through my profile settings and can't spot it !

We are running version 5.3.3 connecting to AS400, but soon to be upgraded to 7.1 Good One (Or so I have been promised!)

I do not get any error message, it just does satisfy the IF statement. I think it is literally looking for what is contained in the brackets and not recognising it as a mask.


WebFocus 765. iSeries v5r4
March 28, 2007, 10:48 AM
Prarie
If you go into your Profile...click Edit and go about half-way down the page...there's a place for Signature. Hopefully one day this will be a mandatory field to fill out so we can alway know what people are working on.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
Aha! Thanks Prarie Smiler


WebFocus 765. iSeries v5r4
mark,you're going to like the new as400 interface for 7. and if you've applied the latest ptf from ibm, i'm surprised your 535 still works well. we had problems after the latest ptf (logicals were illogical)and had to go to 7.
but i'll caution you to WAIT for the 7 version that has just been released, i think 761. because the first verion of 76 makes MFD's with ONLY the short field names; (assuming you're reading db2)...whereas old autosql gave you the option of both long and short field names, which made the masters more informative.
The just-released version does in fact allow you both the long and short names, i have it on good authority from the BGH, but i would check carefully with your rep before upgrading.
The interface is extremely, extremely cool. you will love it!




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID