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     Convert Alphanumeric to Date / DATEPATTERN (SOLVED)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Convert Alphanumeric to Date / DATEPATTERN (SOLVED)
 Login/Join
 
Gold member
posted
Can anyone show me how to convert an alphanumeric value, such as '201208', to a legacy date format 'I6YYM'?

I have tried several different ways to no avail. For example, I thought it would be as easy as this.. (I have only been using WebFocus for about 1 month so please bare with me)

 
TEST_YEAR/YY = '2012';
TEST_MONTH/M = '02';
TEST_YEARMONTH_FROMALPHA/I6YYM = TEST_YEAR | TEST_MONTH; 



Background to my Problem:

I am reading and writing from/to a SQL data source. I have a (YYYYMM) date field which is stored in SQL as an alphanumeric format "varchar(20)" or "A20V" in Focus. I had success at defining my master file with the DATEPATTERN attribute so that WebFocus would automatically convert Alphanumeric data to YYM dates when READING from my datasource. However, now I have an issue when I WRITE data to my SQL table. For example using the modify file function, I am trying to send "201201" as an Alphanumeric... but WebFocus is converting this value and storing it as '1333' in my SQL DB. I know this has something to do with my USAGE attribute = 'YYM'. Therefore, I think if I can convert my alphanumeric input to I6YYM before I pass to SQL , the masterfile should somehow convert this back to Alphanumeric for me...

 
FIELDNAME=ACCOUNTSTARTDATE, ALIAS=ACCOUNTSTARTDATE, DEFCENT=20, USAGE=YYM, ACTUAL=A20V, 
DATEPATTERN='[YYYY][MM]', $ 


Any help would be greatly appreciated.

Thank You,

This message has been edited. Last edited by: Joey Sandoval,




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


 
Posts: 94 | Location: Austin, TX | Registered: August 08, 2012Report This Post
Virtuoso
posted Hide Post
Try this (the concatenation character between the YY and M in the format may not be necessary):

TEST_YEARMONTH_FROMALPHA/A6YY|M = ACCOUNTSTARTDATE ;


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Gold member
posted Hide Post
No I tried this code:
 
TEST_DATE/I6YY|M = '201202';
 


I receive the following error: "NUMERIC ARGUMENTS IN PLACE WHERE ALPHA ARE CALLED FOR"..




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


 
Posts: 94 | Location: Austin, TX | Registered: August 08, 2012Report This Post
Virtuoso
posted Hide Post
Either of these should work, but I thought you wanted to convert ACCOUNTSTARTDATE?

TEST_DATE/A6YYM = '201202';
TEST_DATE/I6YYM = 201202 ;


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Gold member
posted Hide Post
Dan, the A6YYM format worked ..which is good .. but I still have problem when the ACCOUNTSTARTDATE value is passed to SQL.


I am setting "201201" as the ACCOUNTSTARTDATE and passing it to SQL using the modify command. However in my SQL DB it is storing "1333". I think there is something wrong with my master file. Any ideas? (Below is the line from my master)

 FIELDNAME=ACCOUNTSTARTDATE, ALIAS=ACCOUNTSTARTDATE, DEFCENT=20, USAGE=YYM, ACTUAL=A20V, DATEPATTERN='[YYYY][MM]', $
 




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


 
Posts: 94 | Location: Austin, TX | Registered: August 08, 2012Report This Post
Virtuoso
posted Hide Post
You could try changing the USAGE for ACCOUNTSTARTDATE from YYM to A6YYM. I've never seen the DATEPATTERN parameter before and am unfamiliar with its function.


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Gold member
posted Hide Post
I tried changing the usage value to A6YYM, but I received an error. I was only able to save it as YYM.




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


 
Posts: 94 | Location: Austin, TX | Registered: August 08, 2012Report This Post
Gold member
posted Hide Post
Dan I appreciate your help. I ended up removing the DATEPATTERN attribute completely and set both the USAGE and ACTUAL ones to A20 to keep everything consistent.

I then used the format notations you mentioned in defines, when I need the alphanumeric values in a date format.
  
ACCOUNTSTARTDATE_DT/A6YY|M = ACCOUNTSTARTDATE;




Thank you,




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


 
Posts: 94 | Location: Austin, TX | Registered: August 08, 2012Report This Post
Master
posted Hide Post
Seems to me you are over thinking this and you all need is the EDIT function

FIELDNAME=ACCOUNTSTARTDATE, ALIAS=ACCOUNTSTARTDATE, USAGE=A20, ACTUAL=A20,$

TESTDATE/I6YYM=EDIT(EDIT(ACCOUNTSTARTDATE,'999999'));

then when going back to save for MODIFY

ACCOUNTSTARTDATE/A20=EDIT(TESTDATE);


The first EDIT gets the first 6 characters of the string and the 2nd EDIT converts the alpha string to a number. So a string '201202' is converted to a number 201202.

Is that what you need?


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Gold member
posted Hide Post
Yes thank you jgelona. I was not understanding theformats correctly, and I was also trying to take advantage of the DATEPATTERN Attribute in the masterfile which was also causing issues.




Prod/Dev: WebFOCUS 8.0.08 on Windows Server 2008/Tomcat , WebFOCUS DevStudio 8.0.08 on Windows 7 Pro


 
Posts: 94 | Location: Austin, TX | Registered: August 08, 2012Report This Post
Virtuoso
posted Hide Post
There is a way to do this. In the MFD:
.
.
    FIELDNAME=U_ACCOUNTSTARTDATE, ALIAS= ACCOUNTSTARTDATE, USAGE=A20V, ACTUAL=A20V,
    ACCESS_PROPERTY=(INTERNAL), $
    FIELDNAME=ACCOUNTSTARTDATE, ALIAS= ACCOUNTSTARTDATE, USAGE=YYM, ACTUAL=A20V, 
    DATEPATTERN='[YYYY][MM]',$
.
.

As long as you update only U_ACCOUNTSTARTDATE and read ACCOUNTSTARTDATE everything will be fine.

U_ACCOUNTSTARTDATE will not be displayed in the WebFOCUS tools because of the ACCESS_PROPERTY.

DATEPATTERN is a good attribute for all data files except FOC and XFOC, and can overcome many non-standard date based formats.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report 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     Convert Alphanumeric to Date / DATEPATTERN (SOLVED)

Copyright © 1996-2020 Information Builders