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 use -SET using an IF statement but for some reason it is not even showing up as working. I did a -? &M to see all the AMP being used and all show up except this one. Could someone tell me what I have wrong in here, PLEASE. Thank you so much in advance...
SET EMPTYREPORT = ON
SET NODATA = 0
-SET &MONTH1=IF U_Y_M GT YR_MON THEN MON_C ELSE IF U_Y_M LE YR_MON THEN &MONTH ;
-SET &Mnth =DECODE &MONTH(1 'JANUARY' 2 'FEBRUARY' 3 'MARCH' 4 'APRIL' 5 'MAY' 6 'JUNE' 7 'JULY' 8 'AUGUST' 9 'SEPTEMBER' 10 'OCTOBER' 11 'NOVEMBER' 12 'DECEMBER' 01 'JANUARY' 02 'FEBRUARY' 03 'MARCH' 04 'APRIL' 05 'MAY' 06 'JUNE' 07 'JULY' 08 'AUGUST' 09 'SEPTEMBER' ELSE 'Error');
DEFINE FILE MKAGTCTYLIST_3
DATE1_ALPHA/A11=EDIT(MKAGTCTYLIST_3.SEG01.CLOSEOUT_YR);
DATE2_ALPHA/A11L=EDIT(MKAGTCTYLIST_3.SEG01.CLOSEOUT_MO);
DATE1_TRIM/A4=TRIM('L', DATE1_ALPHA, 11, '0', 4, DATE1_TRIM);
DATE2_TRIM/A2L=TRIM('L', DATE2_ALPHA, 11, '0', 2, DATE2_TRIM);
YR_MON/A6=DATE1_TRIM | DATE2_TRIM ;
U_Y_M/A6= '&YEAR' | '&MONTH' ;
CURR/YYMD=&YYMD ;
C_YR/YY=DATEMOV(CURR, 'YY');
MON_C/M=DATEMOV(CURR, 'M');
CU_YR/A4=EDIT(C_YR) ;
CU_MON/A2=EDIT(MON_C) ;
YR_MON/A6=CU_YR | CU_MON ;
MthTargGR/I6=(( &MONTH + 1 - GR_BEG_MO ) * GRTARG) / ( 13 - GR_BEG_MO );
MthTargSGR/I6=(( &MONTH + 1 - SGR_BEG_MO ) * SGRTARG) / ( 13 - SGR_BEG_MO );
MthTargNC1/I6=(( &MONTH + 1 - NC1_BEG_MO ) * CUST1TARG) / ( 13 - NC1_BEG_MO );
MthTargNC2/I6=(( &MONTH + 1 - NC2_BEG_MO ) * CUST2TARG) / ( 13 - NC2_BEG_MO );
MthTargNC3/I6=(( &MONTH + 1 - NC3_BEG_MO ) * CUST3TARG) / ( 13 - NC3_BEG_MO );
TOTNEWCUSTR/I6=TOTNEWCUSTOMER;
TOTCUSTER/I6=TOTNEWCUSTR + TOTGAINED + TOTLOSS;
GRRemain/I6=MthTargGR - TOTCUSTER;
SGRRemain/I6=MthTargSGR - TOTCUSTER;
NC1Remain/I6=MthTargNC1 - TOTNEWCUSTR;
NC2Remain/I6=MthTargNC2 - TOTNEWCUSTR;
NC3Remain/I6=MthTargNC3 - TOTNEWCUSTR;
NEW_GRRemain/I6=IF GRRemain GT 0 THEN GRRemain ELSE 0;
ALPHA_GRRemain/A8=EDIT(NEW_GRRemain);
FIN_GRRemain/A8=IF NEW_GRRemain EQ 0 THEN 'Goal Met' ELSE TRIM('L', ALPHA_GRRemain, 8, '0', 1, 'A8');
NEW_SGRRemain/I6=IF SGRRemain GT 0 THEN SGRRemain ELSE 0;
ALPHA_SGRRemain/A8=EDIT(NEW_SGRRemain);
FIN_SGRRemain/A8=IF NEW_SGRRemain EQ 0 THEN 'Goal Met' ELSE TRIM('L', ALPHA_SGRRemain, 8, '0', 1, 'A8');
NEW_NC1Remain/I6=IF NC1Remain GT 0 THEN NC1Remain ELSE 0;
ALPHA_NC1Remain/A8=EDIT(NEW_NC1Remain);
FIN_NC1Remain/A8=IF NEW_NC1Remain EQ 0 THEN 'Goal Met' ELSE TRIM('L', ALPHA_NC1Remain, 8, '0', 1, 'A8');
NEW_NC2Remain/I6=IF NC2Remain GT 0 THEN NC2Remain ELSE 0;
ALPHA_NC2Remain/A8=EDIT(NEW_NC2Remain);
FIN_NC2Remain/A8=IF NEW_NC2Remain EQ 0 THEN 'Goal Met' ELSE TRIM('L', ALPHA_NC2Remain, 8, '0', 1, 'A8');
NEW_NC3Remain/I6=IF NC3Remain GT 0 THEN NC3Remain ELSE 0;
ALPHA_NC3Remain/A8=EDIT(NEW_NC3Remain);
FIN_NC3Remain/A8=IF NEW_NC3Remain EQ 0 THEN 'Goal Met' ELSE TRIM('L', ALPHA_NC3Remain, 8, '0', 1, 'A8');
END
TABLE FILE MKAGTCTYLIST_3
BY 'MKAGTCTYLIST_3.SEG01.SALES_DIST' AS 'Sales,District'
BY 'MKAGTCTYLIST_3.SEG01.AGCY_CD' AS 'Agency'
BY 'MKAGTCTYLIST_3.SEG01.AGT_CD_TXT' AS 'Agent'
BY 'MKAGTCTYLIST_3.SEG01.AGT_NME_TXT' AS 'Agent Name'
BY 'MKAGTCTYLIST_3.SEG01.TOTNEWCUSTR' AS 'New ,Cust'
BY 'MKAGTCTYLIST_3.SEG01.TOTGAINED' AS 'Customers,Gained'
BY 'MKAGTCTYLIST_3.SEG01.TOTLOSS' AS 'Customers,Lost'
BY 'MKAGTCTYLIST_3.SEG01.TOTCUSTER' AS 'Total,Cust,Growth'
BY 'MKAGTCTYLIST_3.SEG01.MthTargGR' AS 'Growth,Target'
BY 'MKAGTCTYLIST_3.SEG01.FIN_GRRemain' AS 'Remain,Req'
BY 'MKAGTCTYLIST_3.SEG01.MthTargSGR' AS 'Special,Growth,Target'
BY 'MKAGTCTYLIST_3.SEG01.FIN_SGRRemain' AS 'Remain,Req'
BY 'MKAGTCTYLIST_3.SEG01.TOTNEWCUSTR' AS 'Total,New,Cust'
BY 'MKAGTCTYLIST_3.SEG01.MthTargNC1' AS 'Level 1,New Cust,Target'
BY 'MKAGTCTYLIST_3.SEG01.FIN_NC1Remain' AS 'Remain,Req'
BY 'MKAGTCTYLIST_3.SEG01.MthTargNC2' AS 'Level 2,New Cust,Target'
BY 'MKAGTCTYLIST_3.SEG01.FIN_NC2Remain' AS 'Remain,Req'
BY 'MKAGTCTYLIST_3.SEG01.MthTargNC3' AS 'Level 3,New Cust,Target'
BY 'MKAGTCTYLIST_3.SEG01.FIN_NC3Remain' AS 'Remain,Req'
ON MKAGTCTYLIST_3.SEG01.SALES_DIST PAGE-BREAK
ON MKAGTCTYLIST_3.SEG01.AGCY_CD PAGE-BREAK
ON TABLE SUBHEAD
"&YEAR<+0> AGENT CUSTOMER GROWTH AND NEW CUSTOMERS"
"FOR <&MONTH "
"Print Date: <+0>&DATEtrMDYY <+0> "
"Note: Totals for month are not final until 3rd business day"
" "
HEADING
"Sales District: <LST.SALES_DIST Agency: <LST.AGCY_CD "
WHERE ( SALES_DIST EQ &SALES_DIST );
WHERE ( AGCY_CD EQ &AGENCY );
WHERE ( AGT_CD_TXT EQ '&AGENT' );
WHERE ( CLOSEOUT_MO EQ &MONTH1 );
WHERE ( CLOSEOUT_YR EQ &YEAR );
ON TABLE SET PAGE-NUM OFF
ON TABLE SET BYDISPLAY ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT &WFFMT.(<HTML,HTML>,<PDF,PDF>,<Excel 2000,EXL2K>).Select type of display output.
ON TABLE SET HTMLCSS ON
This message has been edited. Last edited by: Latigresa,
I had the &Mnth above it as well. I think I changed it late last night to see if it would work that way and forgot to change it back. I'm using the &Mnth on the heading where the FOR &MONTH1 is but changed it to see what &MONTH1 was displaying but at the moment it's display blank.
Waz is correct. If you don't have &'s then WF thinks that you are comparing literals. Also, it is necessary that your second IF (IF &U_Y_M LE &YR_MON THEN &MONTH) have an ELSE, otherwise what would be the value if the condition is not met.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
-SET &MONTH1=IF U_Y_M GT YR_MON THEN MON_C ELSE IF U_Y_M LE YR_MON THEN &MONTH ;
1. You seem to be trying to compare values in Focus Fields. But -SET knows nothing about Focus variables. U_Y_M, YR_MON and MON_C will be treated as string constants (as if they appeared in quotes). Since 'U' LE 'Y', the first condition is innately false, and the second true, so it is equivalent to -SET &MONTH1= &MONTH ;
2. Your -IF is missing the final ELSE. I know, your intention is that either the first or the second condition is bound to be true, but it's bad form. If somehow neither is true, then no action is taken (which in this case would leave &MONTH1 undefined).
3. Bottom line, both these belong within a DEFINE. Note that you can reference Dialog Manager variables within DEFINE (or other FOCUS commands); the characters forming the value in the &var are substituted for the name of the &var (so &MONTH would become, say, 08; and '&MONTH' becomes '08'), and then the resulting line of code is executed as though the &var value had been hard-coded.
------------ N.B.
This seems to be a field day for confounding FOCUS and Dialog Manager. That's nothing new -- the first issue of the Focus Systems Journal had a tutorial article built arround that very error.
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
For starters, any comparisons you are doing in a -SET must be literals or &variables. You are comparing U_Y_M and YR_MON which appear as literals because they are not preceded by the & sign. You are also setting the value to MON_C which needs to be a value or &var. If these are fields in your database, they cannot be used in Dialogue Manager and should be placed inside a DEFINE as Jack says. Your second -SET would also need to go in there.
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
It seems not to like the "THEN". I get the following error.
0 ERROR AT OR NEAR LINE 57 IN PROCEDURE ADHOCRQ FOCEXEC * (FOC002) A WORD IS NOT RECOGNIZED: THEN BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT
"Then" there's something else in there causing the problem. Let us see what you've got (and please remember to surround them with
[code]
[/code] tags.)
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007
From your code I conclude that the U_Y_M, YR_MON and MON_C fields that you use are fields that come from the database. This means that you cannot use them in a DM -SET statement. Which is why Darin advised you to put the statement in a define. You can just add this defined field to th erest of your defines: [code] -SET &Mnth =DECODE &MONTH(1 'JANUARY' 2 'FEBRUARY' 3 'MARCH' 4 'APRIL' 5 'MAY' - 6 'JUNE' 7 'JULY' 8 'AUGUST' 9 'SEPTEMBER' 10 'OCTOBER' - 11 'NOVEMBER' 12 'DECEMBER' 01 'JANUARY' 02 'FEBRUARY' - 03 'MARCH' 04 'APRIL' 05 'MAY' 06 'JUNE' 07 'JULY' - 08 'AUGUST' 09 'SEPTEMBER' ELSE 'Error');
THANKS!!! You made it work!!! I just had to make a more adjustment on the date format to make it work how the agents want to be able to enter it and all data came up!!! THANK A MILLION!!!