Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] QY format issue while doing READFILE

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] QY format issue while doing READFILE
 Login/Join
 
Member
posted
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 Soorian

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 18 | Registered: May 16, 2014Report This Post
Virtuoso
posted Hide Post
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
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
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? Wink

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Expert
posted Hide Post
quote:
7.7 does have -READFILE as well

Thanks Wep, I couldn't remember so stuck with at least 8.0.something Smiler

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
Syntax on -READ - here
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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Expert
posted Hide Post
If you are going to use -READ, then make sure you use ON TABLE SAVE


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
Thank you all for your response and I used the FPRINT which Tony had mentioned and achieved the requirement.

Regards
Padmavathy Soorian


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 18 | Registered: May 16, 2014Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] QY format issue while doing READFILE

Copyright © 1996-2020 Information Builders