Focal Point
[CLOSED] Read date from HOLD into amper variable

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

October 17, 2011, 02:11 PM
BI_Developer
[CLOSED] Read date from HOLD into amper variable
Hi

I have a HOLD file which has a date field in format HMTDYYS which comes up as something like October 17 2011 07:42:00.

I am trying to read this into amper variable. How can I do this? I am able to read normal text fields but its not working for this date field. I am getting everything as numbers.

Thank you

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


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
October 17, 2011, 02:25 PM
njsden
Is your HOLD file in ALPHA format?

See this:

DEFINE FILE CAR
THEDATE/HMTDYYS WITH CAR = HGETC(8, THEDATE);
END
TABLE FILE CAR
PRINT THEDATE
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD AS MYDATE FORMAT ALPHA
END
-RUN
-READFILE MYDATE
-TYPE Date/Time => &THEDATE




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.
October 17, 2011, 02:26 PM
BI_Developer
My hold file is in Alpha format but the Date field is in HMTDYYS format.

This works well though. Thank you.
quote:
Originally posted by njsden:
Is your HOLD file in ALPHA format?

See this:

DEFINE FILE CAR
THEDATE/A30 WITH CAR = 'October 17 2001 07:42:00';
END
TABLE FILE CAR
PRINT THEDATE
WHERE RECORDLIMIT EQ 1
ON TABLE HOLD AS MYDATE FORMAT ALPHA
END
-RUN
-READFILE MYDATE
-TYPE Date/Time => &THEDATE



WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
October 17, 2011, 02:30 PM
njsden
Please check my adjusted code above. I am creating an HMTDYYS field in a HOLD ALPHA file. I then -READ it in Dialogue Manager and the value (text representation) is being rendered. Isn't this 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.
October 17, 2011, 02:45 PM
Francis Mariani
That's not really a HMTDYYS, it's an alpha field that contains a Date-Time value.

Unfortunately, when you HOLD a formatted Date or Date-Time field, with -READ you will not retrieve what you expect.

Here's a simple test, the MTRDYY formatted DATE2 field data is held as "04232011":

SET HOLDLIST=PRINTONLY
DEFINE FILE CAR
DATE1/YYMD = '2011/04/23';
DATE2/MTRDYY = DATE1;
END
TABLE FILE CAR
SUM
DATE2
COUNTRY
BY COUNTRY
ON TABLE HOLD AS H001 FORMAT ALPHA
END
-RUN

-READ H001 &ZCTRY1.A10. &ZDATE2.A8. &ZCTRY2.A10.

-? &Z



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
October 17, 2011, 02:47 PM
Francis Mariani
You can probably use the HCNVRT (Convert a Date-Time Value to Alphanumeric Format) function...


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
October 17, 2011, 03:12 PM
njsden
What you haven't specified is what you're planning to do with that Date/time value as eventually you'll have to make it an alphanumeric value anyway to pass it from Dialogue Manager to FOCUS for processing.

Following up on Francis comment, you will probably need to use:

1) HINPUT to make the alpha value you read from the HOLD file an "internal" Date/time value (which you cannot really display as Dialogue Manager has no "native" support for it) but will allow to perform date/time operations on it (see point 2)

2) HADD or any other Date/time function to operate on the value you just converted to date/time and do "something" on it

3) HCNVRT to take that modified date/time value and make it an alphanumeric value again that can now be used when its &variable gets rendered to FOCUS ...

Sorry, maybe I'm just lost here because I have no idea of what you're trying to achieve.



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.