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] Concatenate a MDYY field with a numeric field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Concatenate a MDYY field with a numeric field
 Login/Join
 
Silver Member
posted
I want to concatenate a MDYY field with a numeric field that represents the time of day.

This is what I'm doing. I know the date field has a value of 10032013 (since I specified it in the where clause) but the result I am getting is "00041184 004426" The time part is right, but the date part has been mutated somehow.

  DEFINE FILE F554852
ZZZ/A15 = EDIT(TLCRDJ,'99999999') | ' ' | EDIT(TLTDAY);
END
-RUN

TABLE FILE F554852
PRINT ZZZ
TLCRDJ 
TLTDAY  
BY TLCRDJ NOPRINT
BY TLTDAY  NOPRINT
WHERE  TLCRDJ EQ '10032013'
 ON TABLE PCHOLD FORMAT EXCEL
END

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


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
 
Posts: 42 | Registered: April 29, 2010Report This Post
Expert
posted Hide Post
What format is the field TLCRDJ ?

HAve you thought about using a DateTime field instead ?


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
Silver Member
posted Hide Post
FIELD=TLCRDJ,
ALIAS=TLCRDJ, USAGE=MDYY , ACTUAL=DATE,
DESCRIPTION='Creation Date.',
TITLE='Creation Date.',$

This is an old db4 database. The date is actually stored as a numeric field in JDE Julian format in the database. But Webfocus is already converting it to MDYY.


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
 
Posts: 42 | Registered: April 29, 2010Report This Post
Silver Member
posted Hide Post
It would be much easier to convert the TLTDAY to a timestamp and make ZZZ a DateTime value.

Is there some reason why you need it as an alpha character?


WebFOCUS 8.2.02M
Windows
Server/8.2.02M
All Outputs
 
Posts: 43 | Location: Odessa, Florida | Registered: July 26, 2011Report This Post
Silver Member
posted Hide Post
Not really. Can I do this in the report without having to change the masterfiles?


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
 
Posts: 42 | Registered: April 29, 2010Report This Post
Expert
posted Hide Post
As TLCRDJ is MDYY, you can convert it to alpha first.

MDYYTLCRDJ/A8MDYY = TLCRDJ ;
ZZ/A15 = MDYYTLCRDJ | ' ' | EDIT(TLTDAY); 


You could also use the H function to convert to timestamp.


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
Expert
posted Hide Post
DEFINE FILE CAR
-* YOUR FIELDS
TLCRDJ/MDYY = '10/03/2013';
TLTDAY/I6 = 004426;

-* CONVERT TO ALPHA
TLCRDJA/A8YYMD = TLCRDJ;
TLTDAYA/A8 = EDIT(TLTDAY,'99:99:99');
TLTDTTMX/A25 = TLCRDJA | ' ' | TLTDAYA;

-* CONVERT TO DATE-TIME
TLTDTTM/HMDYYS = HINPUT(25, TLTDTTMX, 8, 'HYYMDS');
END

TABLE FILE CAR
PRINT 
TLCRDJ
TLCRDJA
TLTDAY
TLTDAYA
TLTDTTM
COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1
ON TABLE PCHOLD FORMAT EXL2K
END


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
Silver Member
posted Hide Post
Is there a way to take a snippet of code like that and make it into a function?

This message has been edited. Last edited by: Josh K,


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
 
Posts: 42 | Registered: April 29, 2010Report This Post
Expert
posted Hide Post
Yes


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
Silver Member
posted Hide Post
I've tried to make Francis' example use a defined function, but I am getting an error.


     (FOC239) FORMAT DEFINITION IN ERROR. INTERNAL FIELD: DTDP
    BYPASSING TO END OF COMMAND
  0 ERROR AT OR NEAR LINE     34  IN PROCEDURE _ADHOCRQFOCEXEC * 
   (FOC263) EXTERNAL FUNCTION OR LOAD MODULE NOT FOUND: ALPHADT
  0 ERROR AT OR NEAR LINE     40  IN PROCEDURE _ADHOCRQFOCEXEC * 
   (FOC003) THE FIELDNAME IS NOT RECOGNIZED: TLTDTTMX
    BYPASSING TO END OF COMMAND
   (FOC009) INCOMPLETE REQUEST STATEMENT

The code:

 


 DEFINE FUNCTION ALPHADT (DTDP/MDYY, TMPT/I6)
-* CONVERT TO ALPHA
TLCRDJA/A8YYMD = DTDP;
TLTDAYA/A8 = EDIT(TMPT,'99:99:99');
TLTDTTMX/A25 = TLCRDJA | ' ' | TLTDAYA;

-* CONVERT TO DATE-TIME
TLTDTTM/HMDYYS = HINPUT(25, TLTDTTMX, 8, 'HYYMDS');

ALPHADT/A25 = TLTDTTMX;
END


DEFINE FILE CAR
-* YOUR FIELDS
TLCRDJ/MDYY = '10/03/2013';
TLTDAY/I6 = 004426;

TLTDTTMX/A25 = ALPHADT( TLCRDJ, TLTDAY );

END

TABLE FILE CAR
PRINT
TLCRDJ
TLTDAY
TLTDTTMX
COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1
-*ON TABLE PCHOLD FORMAT EXL2K
 ON TABLE PCHOLD FORMAT EXCEL
END
 


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
 
Posts: 42 | Registered: April 29, 2010Report This Post
Expert
posted Hide Post
Well first thing, you are trying to put MDYY into an A8YYMD, Change the format of DTDP to YYMD, and try


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
Silver Member
posted Hide Post
Putting a MDYY into an A8YYMD actually works. What apparently doesn't work is using a MDYY or YYMD as a parameter to a defined function. If I put the MDYY in the A8YYMD first and then send the A8YYMD to the function it works fine.


WebFOCUS 7.6.9
Windows
all output (Excel, HTML, PDF)
 
Posts: 42 | Registered: April 29, 2010Report This Post
Expert
posted Hide Post
I would strongly suggest that you pass though all matching formats.

Also, the technique you use to convert your time field from I6 to A8 is not a safe or future proof method.

You should convert from I to A, then add the colons.


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
  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] Concatenate a MDYY field with a numeric field

Copyright © 1996-2020 Information Builders