Focal Point
[SOLVED] Combining a date and a time

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4067046686

June 07, 2017, 12:59 PM
EvanH
[SOLVED] Combining a date and a time
Hello, I have never done this before, so if i post something weird or incorrectly. Sorry. Could someone please help me join a date to a time in App Studio. The date is in MDYY i.e 06/04/2017 and the time is in HHISsm i.e. 03:39:05:000000. I really would like to get data that is just M/D/YY H:M:Sec i.e. "06/04/2017 03:39:05"

Thank you again and sorry if i posted this in the wrong place.
-Evan

This message has been edited. Last edited by: FP Mod Chuck,


8105M Windows
June 07, 2017, 02:25 PM
FP Mod Chuck
Hi Evan

Welcome to Focal Point, we are glad you are using it. You will find it very helpful for your development questions

In the master file change the ACTUAL and USAGE on the date field to HMDYYS and it should format the way you want it.

Hope this helps,


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 07, 2017, 02:29 PM
Neelima
Can you please try:-
DEFINE FILE CAR
DT/YYMD = '2009/04/14';
TM/A15 = '12.40.41.625652';

DT1/A8YYMD = DT;
TM1/A15 = EDIT(TM,'99$:99$:999999999');
DTTM1/A24 = DT1 | ' ' | TM1;

DTTM2/HYYMDm = HADD(DT(20090414 12:40:41.625652), 'HOUR', 36, 10, 'HYYMDm');

END
TABLE FILE CAR
PRINT
DT
DT1
TM
DTTM1
DTTM2

COUNTRY
END


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
June 07, 2017, 03:28 PM
EvanH
Thank you both for your replies.
Chuck, sorry but I do not have access to alter the master files. I am just a user.

Neelima,
I tried your code, but when I am in the define, it gives me an error regarding the TM/A15 define. When I plug in my data fields it gives me the following error: (FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: TM

Here is my code for the define
DEFINE FILE A_TRANS_DLY ADD
DT/YYMD=A_TRANS_DLY.DATE_POSTED.DTE;
TM/A15=A_TRANS_DLY.TIME_EFFECTIVE.TIME_VAL;
DT1/A8YYMD=DT;
TM1/A15=EDIT(TM,'99$:99$:999999999');
DTTM1/A24=DT1 | ' ' | TM1;
DTTM2/HYYMDm=HADD(DT(20090414 12:40:41.625652), 'HOUR', 36, 10, 'HYYMDm');
END


8105M Windows
June 07, 2017, 03:57 PM
Neelima
just hide these two fields and give it a try


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
June 07, 2017, 05:54 PM
EvanH
what do you mean hide? Also, I am getting the error in the define, not in the display of the report. Sorry. I appreciate your help.


8105M Windows
June 08, 2017, 09:24 AM
FP Mod Chuck
Hi Evan

To hide the field from the report you right mouse click on the field and choose the Visible option to hide. It generates a NOPRINT under the covers.

Please provide the error you are getting on the define.

Thanks


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
June 08, 2017, 10:55 AM
EvanH
Hi Chuck,
Sorry I wasn't clear with my question regarding the hiding. I should have said, "Which two fields? Also I do not understand how setting the two fields to invisible/NOPRINT will avoid the error caused in the define, could you explain that more please?"

The error I am getting in the define is (FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: TM

The field TM is data from a master file in format HHISsm i.e. 03:39:05:000000

Thank you for any help and insight. I appreciate both of your assistance.


8105M Windows
June 08, 2017, 11:07 AM
MartinY
EvanH,

Your error is due to that:
quote:
TM/A15=A_TRANS_DLY.TIME_EFFECTIVE.TIME_VAL;


You cannot copy the value of a HHISsm directly to a A15. There is no automatic conversion for that.

Try the following :
TM/A15=FPRINT(A_TRANS_DLY.TIME_EFFECTIVE.TIME_VAL, 'HHISsm', 'A15');



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
June 08, 2017, 04:59 PM
EvanH
Hi all,
Thank you for your help! I have figured it out. Below is my code for my define.

DEFINE FILE A_TRANS_DLY ADD
DT/MDYY=A_TRANS_DLY.DATE_POSTED.DTE;
TM/A15=FPRINT(A_TRANS_DLY.TIME_EFFECTIVE.TIME_VAL, 'HHISsm', 'A15');
DT1/MDYY=DT;
TM1/A8=EDIT(TM,'99999999');
DT2/A10=FPRINT(DT1,'MDYY','A10');
DTTM1/A25V=DT2| '' |TM1;
DTTM2/HMDYYS=HINPUT(25, DTTM1, 8, 'HMDYYS');
END


8105M Windows