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] YYMDy to A4

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] YYMDy to A4
 Login/Join
 
Platinum Member
posted
Hello

I have a Month field in I2 and I converted it to A2.
I have a Year field which is in YYMDy format. I am trying to convert it to A4 with no luck.

Can anyone suggest how to convert it to A4?

Thanks

This message has been edited. Last edited by: WebFOCUS_Dev,


WebFOCUS 8206
All formats
 
Posts: 95 | Registered: September 13, 2017Report This Post
Virtuoso
posted Hide Post
Do you mean YYMD? If so, are you just trying to extract the YY out of this field?

https://webfocusinfocenter.inf...ng/source/dtpart.htm


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Platinum Member
posted Hide Post
quote:
Originally posted by BabakNYC:
Do you mean YYMD? If so, are you just trying to extract the YY out of this field?

https://webfocusinfocenter.inf...ng/source/dtpart.htm


I have another year field which is in I4. I need to convert it to A4. EDIT is not working. FTOA is giving comma.


WebFOCUS 8206
All formats
 
Posts: 95 | Registered: September 13, 2017Report This Post
Virtuoso
posted Hide Post
To convert a number to character use DIGITS. https://webfocusinfocenter.inf...er/source/digits.htm

 

DEFINE FILE WF_RETAIL_LITE
MEAS1/I8=-123.45;
DIG1/A6=DIGITS(MEAS1,6) ;
DIG2/A6=DIGITS(ID_PRODUCT,6) ;
END
TABLE FILE WF_RETAIL_LITE
PRINT MEAS1 DIG1 
ID_PRODUCT DIG2  
BY PRODUCT_SUBCATEG
WHERE PRODUCT_SUBCATEG EQ 'Flat Panel TV'
ON TABLE SET PAGE NOPAGE
END 


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Virtuoso
posted Hide Post
Or you can also do something similar to this
DEFINE FILE abc
YRX /A4 = LJUST(4, FPRINT(MyYr, 'I4', 'A6'), 'A4');
END


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Gold member
posted Hide Post
Direct conversions to get A4 should work, as in the example below. There is no need to call any subroutine.

DEFINE FILE CAR
MYYR/YYMDy WITH COUNTRY = &YYMD ;
MYYMD/YYMD WITH COUNTRY = &YYMD ;
MYYY/YY = MYYR ;
MYIYY/I4 = MYYY ;
MYAI/A4 = EDIT(MYIYY) ;
MYYA/A4YY = MYYR ;
END
-RUN
TABLE FILE CAR
PRINT MYYMD MYYR MYYY MYIYY MYAI MYYA
IF RECORDLIMIT EQ 1
END
-RUN

 PAGE     1
 
 
 MYYMD       MYYR  MYYY  MYIYY  MYAI  MYYA                                     
 -----       ----  ----  -----  ----  ----                                     
 2018/11/05  2018  2018   2018  2018  2018




IBI Development
 
Posts: 61 | Registered: November 15, 2005Report This Post
Master
posted Hide Post
quote:
Originally posted by WebFOCUS_Dev:
quote:
Originally posted by BabakNYC:
Do you mean YYMD? If so, are you just trying to extract the YY out of this field?

https://webfocusinfocenter.inf...ng/source/dtpart.htm


I have another year field which is in I4. I need to convert it to A4. EDIT is not working. FTOA is giving comma.


Try using PTOA instead of FTOA. Since this function is Packed To Alpha you need to say that the format is a P4 not an I4 in the second parameter.
  
DEFINE FILE CAR
YEAR_I4/I4 WITH COUNTRY = DTPART('&YYMD', YEAR) ;
YEAR_A4/A4=PTOA(YEAR_I4, '(P4)', 'A4')
END
TABLE FILE CAR
PRINT YEAR_I4 YEAR_A4
WHERE RECORDLIMIT EQ 1;
END


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report 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] YYMDy to A4

Copyright © 1996-2020 Information Builders