|
Go
![]() |
New
![]() |
Search
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Gold member |
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, WEBFOCUS 7.6.4 Server: WINXP |
||
|
|
Gold member |
The -SET I'm refering to is the
-SET &MONTH1=IF U_Y_M GT YR_MON THEN MON_C ELSE IF U_Y_M LE YR_MON THEN &MONTH ; Sorry about that. I'm already having a long morning. Ana WEBFOCUS 7.6.4 Server: WINXP |
|||
|
|
Master |
Latigresa,
Where is &MONTH being set?? You have &MONTH1 above &Mnth, and, using it in a WHERE. not using &Mnth, that I can see... Tom Flynn WebFOCUS 5.2.2 thru 7.6.x Windows, Unix, MVS |
|||
|
|
Guru |
I think you need some &'s in the line above. -SET &MONTH1=IF &U_Y_M GT &YR_MON THEN &MON_C ELSE IF &U_Y_M LE &YR_MON THEN &MONTH ; Waz...
|
|||||||||||
|
|
Guru |
That one line of code -SET &Mnth works fine for me!
Are you looking at the very first error message that's returned from FOCUS?
|
|||||
|
|
Gold member |
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.
Ana WEBFOCUS 7.6.4 Server: WINXP |
|||
|
|
Master |
Tigresa,
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. |
|||
|
|
Guru |
Try it like this in your heading;
"FOR &MONTH "
|
|||||
|
|
Gold member |
I have changed it to
-SET &MONTH1=IF U_Y_M GT YR_MON THEN MON_C ELSE IF U_Y_M LE YR_MON THEN &MONTH ELSE MON_C ; ANd I place &MONTH for the Heading but still blank on both. WEBFOCUS 7.6.4 Server: WINXP |
|||
|
|
Expert |
Sounds to me that Latigresa is trying to combine dialogue manager with DEFINE and/or COMPUTE syntax - e.g. trying to reference a field within DM.
Second person today to try that! T Old FOCUS coders never die, they just become functionally stable. (Tony A
|
|||||
|
|
Master |
The line before that needs attention:
-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 7.6.7, Win |
|||
|
|
Gold member |
UUUmmmm...you just went way over my head there...
Could you give me a more direct direction if that is even possible... WEBFOCUS 7.6.4 Server: WINXP |
|||
|
|
Virtuoso |
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.
DEFINE FILE filename MONTH1/A2=IF U_Y_M GT YR_MON THEN MON_C ELSE &MONTH ; Mnth/A9 =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'); END Regards, Darin WF Server: 7.1.6 on Z/OS and Linux, ReportCaster, Self-Service, MRE, Java Data: DB2, DB2/UDB, Adabas, SQL Server Output: HTML,PDF,Excel2K WF Client: Linux w/WebSphere, Servlet, CGI |
|||
|
|
Gold member |
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 WEBFOCUS 7.6.4 Server: WINXP |
|||
|
|
Virtuoso |
"Then"
[code][/code] tags.) Regards, Darin WF Server: 7.1.6 on Z/OS and Linux, ReportCaster, Self-Service, MRE, Java Data: DB2, DB2/UDB, Adabas, SQL Server Output: HTML,PDF,Excel2K WF Client: Linux w/WebSphere, Servlet, CGI |
|||
|
|
Master |
Ana,
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'); 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 ; MONTH1/M=IF U_Y_M GT YR_MON THEN MON_C ELSE IF U_Y_M LE YR_MON THEN &MONTH ELSE MON_C; .... [/quote] And then you could use the field MONTH1 in place of the &MONTH1 in your request: WHERE ( CLOSEOUT_MO EQ MONTH1 ); Hope this helps ... GamP
|
|||||
|
|
Virtuoso |
Tigra
I would suggest to start with -SET &ECHO=ALL; You get more debugging info. Next to do some debugging add the line -TYPE &MONTH1 &MONTH &Mnth -EXIT see what you get....
|
|||||||
|
|
Gold member |
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!!!
WEBFOCUS 7.6.4 Server: WINXP |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

