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] Building a DEFINE field for Credit Card Dates

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Building a DEFINE field for Credit Card Dates
 Login/Join
 
Member
posted
I need to build a new DEFINE field in my MAS file that is the number of months until a credit card expires. In the data now I have two I11 fields, CREDITCARDEXPMO and CREDITCARDEXPYR (integer month and year).

So far I have been able to build a composite expiration date (A10V) field as shown below:




EDIT(FPRINT(CREDITCARDEXPMO, 'I11', 'A11'),'$$$$$$$$$99') | '/01/' | EDIT(FPRINT(CREDITCARDEXPYR, 'I11', 'A11'),'$$$$$$$9999') 




Now I need to convert this from A10V to YYMD, however DATECNV(^that expression above^, 'A10V','YYMD') only return blanks which makes me believe there is an error above.

Ideas or alternative methods to accomplish this are most welcome.

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


WebFOCUS Version: 7703
Windows, all output
 
Posts: 16 | Registered: August 18, 2011Report This Post
Virtuoso
posted Hide Post
Try this:

CC_EXPIRE/A8YYMD = EDIT(FPRINT(CREDITCARDEXPYR, 'I11', 'A11'),'$$$$$$$9999') | EDIT(FPRINT(CREDITCARDEXPMO, 'I11', 'A11'),'$$$$$$$$$99') | '01';
CARD_EXPIRE/YYMD = CC_EXPIRE ;

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Member
posted Hide Post
So far so ... strange.

I have implemented your suggestion and see valid dates in the CARD_EXPIRE field (YYMD) such as 2010/12/01 and 2012/11/01.

Then in my final step I added another DEFINE (I4) as:

 
DATEDIF(&YYMD, CARD_EXPIRE, 'M') 


And my resulting integer values appear to be 1319 to 1342 respectively.

Any idea why my months difference seem so high?


WebFOCUS Version: 7703
Windows, all output
 
Posts: 16 | Registered: August 18, 2011Report This Post
Virtuoso
posted Hide Post
Try putting single quotes around &YYMD:

DATEDIF('&YYMD', CARD_EXPIRE, 'M');


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Virtuoso
posted Hide Post
ewinery, in order to make use of WebFOCUS date functions (DATEDIF, DATEMOV, DATEADD, etc.) you have to convert your &YYMD value (which today looks like 20111219 and is sort of equivalent to what FOCUS calls a SmartDate) and convert it to a "date" as WebFOCUS expects.

Try:
DATEDIF(DATECVT('&YYMD', 'A8YYMD', 'YYMD'), CARD_EXPIRE, 'M') 


That would probably give you what you need.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Member
posted Hide Post
quote:
DATEDIF(DATECVT('&YYMD', 'A8YYMD', 'YYMD'), CARD_EXPIRE, 'M')



That does the trick. Thanks.


WebFOCUS Version: 7703
Windows, all output
 
Posts: 16 | Registered: August 18, 2011Report This Post
Virtuoso
posted Hide Post
Another solution using the CAR file.
I created 2 fields for Month and Year: EXPMO EXPYR.
Since your fields are already numbers, a bit of arithmetic is in order instead of converting to alpha (EXPDT). Then a simple assignment converts to a FOCUS date (EXPMY), after which a substraction provides the result (MONTHS). Use &DATEMYY for today's date:
  
DEFINE FILE CAR
EXPMO/I2=1 + IMOD( DEALER_COST, 12, 'I2');
EXPYR/I4=2012 + IMOD(RETAIL_COST, 10, 'I2');
EXPDT/I6MYY=EXPMO*10000 + EXPYR;
EXPMY/MYY=EXPDT;
TDY/MYY='&DATEMYY';
MONTHS/I4=EXPMY - TDY;
END
TABLE FILE CAR
PRINT 
     CAR
     EXPMO
     EXPYR
     EXPMY
     TDY
     MONTHS
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report 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] Building a DEFINE field for Credit Card Dates

Copyright © 1996-2020 Information Builders