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] date result dosen't match with the field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] date result dosen't match with the field
 Login/Join
 
Member
posted
Hi guys i am trying to run the following code but says
Error: FOC282 RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD,

Code: DEFINE FILE USER_HOLD
-*TEST/I11 = IF LOGINS EQ 0 THEN 0 ELSE 1;
D_DATE/DMY = HDATE(CERTIFICATIONDATE, 'YYMD');
I_MONTH/I2 = DPART(D_DATE, 'MM', 'I11');
S_MONTH/M = I_MONTH;
A_MONTH/A4 = EDIT(I_MONTH); -* the error is at -*this line.
I_YEAR/I4 = DPART(D_DATE, 'YEAR', 'I11');
S_YEAR/YY = I_YEAR;
A_YEAR/A4 = EDIT(I_YEAR);
A_YEAR_MONTH/A8 = A_YEAR|A_MONTH;
END

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


8008
 
Posts: 4 | Location: India | Registered: April 28, 2015Report This Post
Expert
posted Hide Post
1) What is the format of CERTIFICATIONDATE?
2) Please tell us what you're trying to do. You may be overdoing the code...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
Well the CERTIFICATIONDATE is in TIMESTAMP FORMAT Without TIMEZONE
and i m trying to convert the date into month in alphanumeric format


8008
 
Posts: 4 | Location: India | Registered: April 28, 2015Report This Post
Expert
posted Hide Post
Shortest form that you could use is something like -
D_DATE/A8 = DATECVT(HDATE(CERTIFICATIONDATE, 'YYMD'), 'YYMD', 'A8YYMD');

Remember the help pages for Functions (plus lots more) online - 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 only want YYM in alpha format then just use -
D_DATE/A6 = DATECVT(HDATE(CERTIFICATIONDATE, 'YYMD'), 'YYMD', 'A6YYM');


quote:
You may be overdoing the code...

Just a little I think Wink

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
Member
posted Hide Post
Thanks for your solution However i need those value to use further to generate report. SO i'm not overdoing it!


8008
 
Posts: 4 | Location: India | Registered: April 28, 2015Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Kapil Shinde:
Hi guys i am trying to run the following code but says
Error: FOC282 RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD,

DEFINE FILE USER_HOLD
-*TEST/I11 = IF LOGINS EQ 0 THEN 0 ELSE 1;
D_DATE/DMY  = HDATE(CERTIFICATIONDATE, 'YYMD');
I_MONTH/I2 = DPART(D_DATE, 'MM', 'I11');
S_MONTH/M = I_MONTH;
A_MONTH/A4 = EDIT(I_MONTH); -* the error is at    -*this line. 
I_YEAR/I4 = DPART(D_DATE, 'YEAR', 'I11');
S_YEAR/YY = I_YEAR;
A_YEAR/A4 = EDIT(I_YEAR);
A_YEAR_MONTH/A8 = A_YEAR|A_MONTH;
END


First off, put your code between
[code]
[/code] tags.

Don't return an 'I11' if you're only going to use 2 or 4 decimals anyway. Better yet, return the value into the virtual field you're defining, that takes care of the field size automatically (I still think it's silly that FOCUS doesn't do that for us). That's probably why FOCUS thinks that I_MONTH won't fit in an A4 field; remember that that /I2 only specifies the display format, internally you made that field an I11.

And why are you using DPART instead of HPART? You don't need that D_DATE field at all.

Try this:
-*D_DATE/DMY  = HDATE(CERTIFICATIONDATE, 'YYMD');
I_MONTH/I2 = HPART(CERTIFICATIONDATE, 'MM', I_MONTH);
S_MONTH/M = I_MONTH;
A_MONTH/A4 = EDIT(I_MONTH); -* the error is at    -*this line. 
I_YEAR/I4 = HPART(CERTIFICATIONDATE, 'YEAR', I_YEAR);
S_YEAR/YY = I_YEAR;
A_YEAR/A4 = EDIT(I_YEAR);
A_YEAR_MONTH/A8 = A_YEAR|A_MONTH;


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
Member
posted Hide Post
Thanks all of you. I'm helpful to think and try different approach finally i succefully run the part coz of ur support. Thanks again!


8008
 
Posts: 4 | Location: India | Registered: April 28, 2015Report This Post
Expert
posted Hide Post
Bearing in mind that your sample only appears to have some defines that are used to build a single result - A_YEAR_MONTH (with the exception of S_MONTH and S_YEAR).

What I meant by overdoing it is, that in your sample, you convert CERTIFICATIONDATE into D_DATE and then convert that into I_MONTH and I_YEAR. You further convert I_MONTH into A_MONTH and I_YEAR into A_YEAR before combining both of those fields into A_YEAR_MONTH which is probably an extra 20 bytes per row of data pulled into the internal matrix in excess of the actual 8 bytes that is the ultimate result.

If you multiply those 20 bytes by the number of rows returned from your request then your internal matrix is bigger than what it needs to be.

Hopefully you understand what I meant? 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
Virtuoso
posted Hide Post
quote:
Then you'll see, that it is not the internal spoon that bends, it is only yourself.


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
  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] date result dosen't match with the field

Copyright © 1996-2020 Information Builders