Hi, I am facing issues in QY date format while doing -READFILE <>.
DEFINE FILE EMPLOYEE METRI1/QY=DATECVT(HIRE_DATE,'I6YMD','QY'); END
TABLE FILE EMPLOYEE PRINT SALARY HIRE_DATE METRI1 ON TABLE HOLD AS HLD1 END
TABLE FILE HLD1 SUM SALARY BY METRI1 -*ON TABLE HOLD AS DATE_FO END
The above is giving me the output like, Q1 80 Q2 82 But When I create a hold file for the same data and try to read it is showing in different format. Please refer below
-DEFAULTH &METRI1=''; -DEFAULTH &COLUMN_ORD=''; DEFINE FILE EMPLOYEE METRI1/QY=DATECVT(HIRE_DATE,'I6YMD','QY'); END
TABLE FILE EMPLOYEE PRINT SALARY HIRE_DATE METRI1 ON TABLE HOLD AS HLD1 END
TABLE FILE HLD1 SUM SALARY BY METRI1 ON TABLE HOLD AS DATE_FO END
-SET &LNS=&LINES; -REPEAT :BUILD_COL &LNS TIMES -RUN -READFILE DATE_FO -SET &COLUMN_ORD=&COLUMN_ORD | ' AND ' | &METRI1; -:BUILD_COL -TYPE &COLUMN_ORD
Please help me to get Q YY format while doing -READFILE from holdfile.
Thanks & Regards Padmavathy SoorianThis message has been edited. Last edited by: <Kathryn Henning>,
WebFOCUS 7.6 Windows, All Outputs
July 15, 2015, 10:41 AM
GamP
With the below code I was able to obtain the correct result. I could not get it to work with READFILE.
-DEFAULTH &METRI1=''
-DEFAULTH &COLUMN_ORD=''
DEFINE FILE EMPLOYEE
METRI1/QY=DATECVT(HIRE_DATE,'I6YMD','QY');
END
TABLE FILE EMPLOYEE
PRINT SALARY
HIRE_DATE
METRI1
ON TABLE HOLD AS HLD1
END
TABLE FILE HLD1
SUM SALARY
BY METRI1
ON TABLE HOLD AS DATE_FO FORMAT ALPHA
END
-SET &LNS=&LINES;
-REPEAT :BUILD_COL &LNS TIMES
-READ DATE_FO &METRI1.3. &SALARY.12.
-SET &COLUMN_ORD=&COLUMN_ORD | ' AND ' | &METRI1;
-:BUILD_COL
-TYPE &COLUMN_ORD
So I had to do a hold format alpha, and then read the lines one by one, using &'s to split the data. But the result is ok now, I guess. it now shows:
AND 280 AND 381 AND 481 AND 182 AND 282 AND 382
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
July 15, 2015, 10:50 AM
Tony A
Stop and think about what you are doing - in your first section you specify a format of QY in the format but you say that you want QYY.
Any ideas of what you need to do yet for this one?
The second point is closely related in that what you are seeing is a month followed by the 2 digit year. This represents the first month within the quarter (the third one actually should be 1082 I believe). Again, changing the format to QYY will give you month century and year - with the same comment on 01982.
If you wish to have the actual alpha representation then go to one of the most useful functions, FPRINT.
METRI2/A8 = FPRINT(METRI1, 'QYY', 'A8');
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
July 15, 2015, 10:58 AM
Tony A
quote:
&METRI1.3. &SALARY.12.
GamP,
Long time no see!
For info. the syntax is being tightened. So for -READ the syntax should have both a leading and trailing period (as you have) but also it should have the format of which only Alpha and Integer are valid. The formats should relate to how the variable is being subsequently used.
When you get to 8.0.something, then you'll be able to use -READFILE which uses the synonym to determine the variable names and formats.
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
July 15, 2015, 11:01 AM
Wep5622
7.7 does have -READFILE as well. 7.6 probably doesn't though.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
July 15, 2015, 11:09 AM
Tony A
quote:
7.7 does have -READFILE as well
Thanks Wep, I couldn't remember so stuck with at least 8.0.something
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