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.
I am trying to do a If statment around a where statement and could use some help.
If &startdate eq '' then
where (Tax_period EQ '&Tax_period.(FIND TAX_PERIOD IN DBO_PERIOD).Tax_period.'
else
WHERE ( Processed_Date GE DT(&StartDate) AND Processed_Date LE DT(&EndDate))
Im not really sure how to do this, can anyone lend a hand?This message has been edited. Last edited by: Erney,
IF &startdate EQ '' THEN GOTO LAB1;
ELSE GOTO LAB2;
-LAB1
where (Tax_period EQ '&Tax_period.(FIND TAX_PERIOD IN DBO_PERIOD).Tax_period.'
-GOTO ENDLAB;
-LAB2
WHERE ( Processed_Date GE DT(&StartDate) AND Processed_Date LE DT(&EndDate))
-ENDLAB
This is what i got so far, I must have some syntax wrong because its bombing. I decided to change the if statement around to check tax_period to see if its blank.
-IF &Tax_period EQ MISSING THEN GOTO LAB1;
ELSE GOTO LAB2;
-LAB1
WHERE ( Processed_Date GE DT(&StartDate) AND Processed_Date LE DT(&EndDate))
GOTO ENDLAB;
-LAB2
WHERE (Tax_period EQ '&Tax_period')
-ENDLAB
I am not so sure that MISSING can be used withing the context of Dialog Manager.
I would suggest that you always initialize your variables with "something" so you can easily determine whether or not a value was provided by the user. What about this slimmed-down piece:
-DEFAULTS &startdate = '19000101';
-DEFAULTS &Tax_period = 'NONE';
-IF &startdate EQ '19000101' THEN GOTO :FTAXPRD;
WHERE ( Processed_Date GE DT(&StartDate) AND Processed_Date LE DT(&EndDate))
-GOTO -:FEND;
-:FTAXPRD
WHERE (Tax_period EQ '&Tax_period')
-:FEND
That may be the reason of the error. You started an -IF command (which belongs to the realm of Dialog Manager) and in the next line you put an ELSE keyword which belong to [Web]FOCUS language syntax.
What WebFOCUS is actually "seeing" after Dialog Manager is resolved is just an orphan ELSE keyword not belonging to any IF statement.
Try the piece of code I posted previously to see if it makes a difference.
If &startdate eq '' then where (Tax_period EQ '&Tax_period.(FIND TAX_PERIOD IN DBO_PERIOD).Tax_period.' else WHERE ( Processed_Date GE DT(&StartDate) AND Processed_Date LE DT(&EndDate))
Change the WHERE clause to:
WHERE (Tax_period EQ '&Tax_period.(FIND TAX_PERIOD IN DBO_PERIOD).Tax_period.' AND &startdate eq '') OR
( Processed_Date GE DT(&StartDate) AND Processed_Date LE DT(&EndDate))
Developer Studio 7.6.11 AS400 - V5R4 HTML,PDF,XLS
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008
Try using DM commands -SET &TEST1=IF&startdate eq '' then - 'where (Tax_period EQ '&Tax_period.(FIND TAX_PERIOD IN DBO_PERIOD).Tax_period.'' - else 'WHERE ( Processed_Date GE DT(&StartDate) AND Processed_Date LE DT(&EndDate';
TABLE FILE WHATEVER PRINT * &TEST1 END
You do need to make sure that you use the correct number of '.
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit
'WHERE ( Processed_Date GE DT(&StartDate) AND Processed_Date LE DT(&EndDate))';
quote:
Originally posted by RSquared: Try using DM commands -SET &TEST1=IF&startdate eq '' then - 'where (Tax_period EQ '&Tax_period.(FIND TAX_PERIOD IN DBO_PERIOD).Tax_period.'' - else 'WHERE ( Processed_Date GE DT(&StartDate) AND Processed_Date LE DT(&EndDate';
TABLE FILE WHATEVER PRINT * &TEST1 END
You do need to make sure that you use the correct number of '.
ABT, you are correct. However, I was just trying to pass along a concept that I have used that might help others with this type of problem. I do have a slight problem with mis-typing and incomplete copying. so thanks.
WF 7.6.11 Oracle WebSphere Windows NT-5.2 x86 32bit
-IF &Tax_period EQ '' THEN GOTO LAB1;
-ELSE GOTO LAB2;
-LAB1
WHERE ( Processed_Date GE DT(&StartDate) AND Processed_Date LE DT(&EndDate))
-GOTO ENDLAB;
-LAB2
WHERE (Tax_period EQ '&Tax_period')
-ENDLAB