TABLE FILE XYZ PRINT REALFIELD NOPRINT &From_OFC1 &To_OFC1 &From_num1 &To_num1 .. etc. ON TABLE HOLD FORMAT FOCUS INDEX whatever .. END
EX -LINES * EDAPUT MASTER,ofc,CV,MEM FILENAME=ofc,SUFFIX=FOC,$ SEGNAME=OFC,SEGTYPE=,$ FIELD=From_OFC,,a24,$ FIELD=To_OFC,,a24,$ FIELD=From_num,,i10,$ FIELD=To_num,,i10,$ EDAPUT* CREATE FILE ofc MODIFY FILE ofc FREEFORM From_OFC To_OFC From_num To_num DATA &From_OFC1, &To_OFC1, &From_num1, &To_num1,$ &From_OFC2, &To_OFC2, &From_num2, &To_num2,$ &From_OFC3, &To_OFC3, &From_num3, &To_num3,$ &From_OFC4, &To_OFC4, &From_num4, &To_num4,$ &From_OFC5, &To_OFC5, &From_num5, &To_num5,$ END TABLE FILE ofc PRINT * END
quote:Does that work?
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 |
-** I have 4 set of input parameters, here I simply it with 2 sets -DEFAULT &FROM_OFC1 = '03-BALTIMORE'; -DEFAULT &TO_OFC1 = '12-NHC BALTIMORE'; -DEFAULT &TRAN_NUM_1 = '10'; -DEFAULT &FROM_OFC2 = '03-BALTIMORE'; -DEFAULT &TO_OFC2 = '12-NHC CHICAGO'; -DEFAULT &TRAN_NUM_2 = '20'; -**** my main FOC table is in my working folder, so I place my temp foc in the same folder, it may not be necessary, but I try to play safe….. APP HOLD my working folder -RUN -********************** use FILEDEF and WRITE *************** -** Create master for TRANSFILE ***** FILEDEF DATAMAST DISK TRANSFILE.MAS -RUN -WRITE DATAMAST FILE=TRANSFILE, SUFFIX=FIX, $ -WRITE DATAMAST SEGNAME=SEG1, SEGTYPE=S0, $ -WRITE DATAMAST FIELD=TRAN_FLG, ALIAS=TRAN_FLG, USAGE=A1, ACTUAL=A1, $ -WRITE DATAMAST FIELD=TRAN_PEND, ALIAS=TRAN_PEND, USAGE=A4, ACTUAL=A4, $ -WRITE DATAMAST FIELD=OFFICE, ALIAS=OFFICE, USAGE=A45, ACTUAL=A45, $ -** Create data file for TRANSFILE ***** -** I have trouble use WRITE to enter Integer, so I define ‘TRAN_PEND’ as Alpha, then will convert it to INT. -** the OFFICE name is various length, so I place it to the last. FILEDEF TRANSFILE DISK TRANSFILE.FTM -RUN -WRITE TRANSFILE F &TRAN_NUM_1 &FROM_OFC1 -WRITE TRANSFILE T &TRAN_NUM_1 &TO_OFC1 -WRITE TRANSFILE F &TRAN_NUM_2 &FROM_OFC2 -WRITE TRANSFILE T &TRAN_NUM_2 &TO_OFC2 -RUN DEFINE FILE TRANSFILE CNT/I11 = EDIT(TRAN_PEND); TRAN_CNT/I11 = IF TRAN_FLG EQ 'T' THEN CNT ELSE IF TRAN_FLG EQ 'F' THEN 0 - CNT ELSE 0; END -* before using SUM command, I found the hold the file need to have the INDEX -* TABLE FILE TRANSFILE PRINT TRAN_CNT TRAN_FLG BY OFFICE ON TABLE HOLD AS TRANSTEMP FORMAT FOCUS INDEX OFFICE END -RUN -** Sum the input file with office to reduce multiple office rows TABLE FILE TRANSTEMP SUM TRAN_CNT TRAN_FLG BY OFFICE ON TABLE HOLD AS TRANSHOLD FORMAT FOCUS INDEX OFFICE END -RUN * -************************************************************* -*JOIN TO EM_MAIN TABLE, both table should have indexed with OFFICE -********************************************************** JOIN CLEAR * JOIN OFFICE IN EM_MAIN TO OFFICE IN TRANSHOLD AS J1 -RUN DEFINE FILE EM_MAIN NEW_TOTAL_PEND/I11 = PENDING + TRAN_CNT; END -*****Try to print office which has match rows, that is also has TRAN_FLG EQ ‘T’ or ‘F’ TABLE FILE EM_MAIN PRINT TRANS_FLG EM_MAIN.SEG01.OFFICE EM_MAIN.NEW_TOTAL_PEND BY EM_ MAIN.OFFICE WHERE TRAN_FLG EQ 'T' OR TRAN_FLG EQ 'F' ON TABLE PCHOLD FORMAT HTML ON TABLE SET STYLE * $ ENDSTYLE END -RUN
quote:
EX -LINES * EDAPUT MASTER,ofc,CV,MEM
...
EDAPUT*
quote:people like me who can't count
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 |
quote:Originally posted by Emily Lee:
Thanks for all your helpful suggestions. I searched the EDAPUT, then I found Francis Mariani’s WRITE method in the following post. It is easy for me to understand, so I took that approach..
http://forums.informationbuild...091012803#8091012803
I made it worked. I can do TABLE print of the FOCUS hold file which has all my input lines. But I got stocked with new error, which took me two days, still don’t know why….. I try to use the new FOCUS HOLD file to join with the main focus file, it seems the office name never matched in the JOIN. I have carefully checked the office name spelling in my default values, with the office name in my main focus table. What could be wrong??? Thanks in advanced.
Here is my code ( simplified) …-** I have 4 set of input parameters, here I simply it with 2 sets -DEFAULT &FROM_OFC1 = '03-BALTIMORE'; -DEFAULT &TO_OFC1 = '12-NHC BALTIMORE'; -DEFAULT &TRAN_NUM_1 = '10'; -DEFAULT &FROM_OFC2 = '03-BALTIMORE'; -DEFAULT &TO_OFC2 = '12-NHC CHICAGO'; -DEFAULT &TRAN_NUM_2 = '20'; -**** my main FOC table is in my working folder, so I place my temp foc in the same folder, it may not be necessary, but I try to play safe….. APP HOLD my working folder -RUN -********************** use FILEDEF and WRITE *************** -** Create master for TRANSFILE ***** FILEDEF DATAMAST DISK TRANSFILE.MAS -RUN -WRITE DATAMAST FILE=TRANSFILE, SUFFIX=FIX, $ -WRITE DATAMAST SEGNAME=SEG1, SEGTYPE=S0, $ -WRITE DATAMAST FIELD=TRAN_FLG, ALIAS=TRAN_FLG, USAGE=A1, ACTUAL=A1, $ -WRITE DATAMAST FIELD=TRAN_PEND, ALIAS=TRAN_PEND, USAGE=A4, ACTUAL=A4, $ -WRITE DATAMAST FIELD=OFFICE, ALIAS=OFFICE, USAGE=A45, ACTUAL=A45, $ -** Create data file for TRANSFILE ***** -** I have trouble use WRITE to enter Integer, so I define ‘TRAN_PEND’ as Alpha, then will convert it to INT. -** the OFFICE name is various length, so I place it to the last. FILEDEF TRANSFILE DISK TRANSFILE.FTM -RUN -WRITE TRANSFILE F &TRAN_NUM_1 &FROM_OFC1 -WRITE TRANSFILE T &TRAN_NUM_1 &TO_OFC1 -WRITE TRANSFILE F &TRAN_NUM_2 &FROM_OFC2 -WRITE TRANSFILE T &TRAN_NUM_2 &TO_OFC2 -RUN DEFINE FILE TRANSFILE CNT/I11 = EDIT(TRAN_PEND); TRAN_CNT/I11 = IF TRAN_FLG EQ 'T' THEN CNT ELSE IF TRAN_FLG EQ 'F' THEN 0 - CNT ELSE 0; END -* before using SUM command, I found the hold the file need to have the INDEX -* TABLE FILE TRANSFILE PRINT TRAN_CNT TRAN_FLG BY OFFICE ON TABLE HOLD AS TRANSTEMP FORMAT FOCUS INDEX OFFICE END -RUN -** Sum the input file with office to reduce multiple office rows TABLE FILE TRANSTEMP SUM TRAN_CNT TRAN_FLG BY OFFICE ON TABLE HOLD AS TRANSHOLD FORMAT FOCUS INDEX OFFICE END -RUN * -************************************************************* -*JOIN TO EM_MAIN TABLE, both table should have indexed with OFFICE -********************************************************** JOIN CLEAR * JOIN OFFICE IN EM_MAIN TO OFFICE IN TRANSHOLD AS J1 -RUN DEFINE FILE EM_MAIN NEW_TOTAL_PEND/I11 = PENDING + TRAN_CNT; END -*****Try to print office which has match rows, that is also has TRAN_FLG EQ ‘T’ or ‘F’ TABLE FILE EM_MAIN PRINT TRANS_FLG EM_MAIN.SEG01.OFFICE EM_MAIN.NEW_TOTAL_PEND BY EM_ MAIN.OFFICE WHERE TRAN_FLG EQ 'T' OR TRAN_FLG EQ 'F' ON TABLE PCHOLD FORMAT HTML ON TABLE SET STYLE * $ ENDSTYLE END -RUN