February 13, 2008, 08:52 AM
LOgleHere is what I tried.
Define file Patient
NUMSEC/I4 = 244;
HOUR/I2 = (NUMSEC/60) ;
MIN/I2 = ((NUMSEC/60 - (HOUR *60)));
HHMMSS/I6= INT( NUMSEC/3600 ) * 10000
+ INT( IMOD(NUMSEC,3600,'I4')/60 ) * 100 +
IMOD(NUMSEC,60,'I2');
TIME/A8=EDIT(HHMMSS,'99:99:99');
WHERE APPOINT.APPOINT.FROM EQ TIME;
I did not design the database but go figure the field for the Appt Time is FROM
February 13, 2008, 09:11 AM
LOgleNUMBER (10)
and Yes my original field is a Number field. Thanks!
February 13, 2008, 09:41 AM
GamPWell, that seems about right to me. I took the code you provided and stuck it in a define for the car database, and the time comes out just fine. My code:
DEFINE FILE CAR
NUMSEC/I4 WITH CAR = 244;
HOUR/I2 = (NUMSEC/60) ;
MIN/I2 = ((NUMSEC/60 - (HOUR *60)));
HHMMSS/I6= INT( NUMSEC/3600 ) * 10000
+ INT( IMOD(NUMSEC,3600,'I4')/60 ) * 100
+ IMOD(NUMSEC,60,'I2');
TIME/A8=EDIT(HHMMSS,'99:99:99');
END
TABLE FILE CAR
PRINT CAR TIME
END
For every record it show the time as being 00:04:04, which corresponds perfectly with the 244 that we put into the NUMSEC field.
What
exactly is your problem?
February 13, 2008, 01:30 PM
LOglequote:
DEFINE FILE CAR
NUMSEC/I4 WITH CAR = 244;
HOUR/I2 = (NUMSEC/60) ;
MIN/I2 = ((NUMSEC/60 - (HOUR *60)));
HHMMSS/I6= INT( NUMSEC/3600 ) * 10000
+ INT( IMOD(NUMSEC,3600,'I4')/60 ) * 100
+ IMOD(NUMSEC,60,'I2');
TIME/A8=EDIT(HHMMSS,'99:99:99');
END
TABLE FILE CAR
PRINT CAR TIME
END
This is what it returns.
FIRST LAST HOMEAREA HOMEPHONE DATE FROM STATUS TIME
John Doe 615 887-0000 2008/02/15 540 ACTIVE 00:00:00
Jane Doe 615 641-0000 2008/02/15 540 ACTIVE 00:00:00
Here is my Code:
DEFINE FILE PATIENT
THISDAY/YYMD = &YYMD;
TDAY/YYMD = DATEADD(THISDAY, 'BD',2 );
NUMSEC/I4 WITH PATIENT = '';
HOUR/I2 = (NUMSEC/60) ;
MIN/I2 = ((NUMSEC/60 - (HOUR *60)));
HHMMSS/I6= INT( NUMSEC/3600 ) * 10000
+ INT( IMOD(NUMSEC,3600,'I4')/60 ) * 100
+ IMOD(NUMSEC,60,'I2');
TIME/A8=EDIT(HHMMSS,'99:99:99');
END
TABLE FILE PATIENT
PRINT
'PATIENT.PATIENT.FIRST'
'PATIENT.PATIENT.LAST'
'PATIENT.PATIENT.HOMEAREA'
'PATIENT.PATIENT.HOMEPHONE'
'APPOINT.APPOINT.DATE'
'APPOINT.APPOINT.FROM'
'PATIENT.PATIENT.STATUS'
'TIME'
February 13, 2008, 02:27 PM
Francis Marianiquote:
DEFINE FILE CAR
NUMSEC/I4 WITH CAR = 244;
HOUR/I2 = (NUMSEC/60) ;
MIN/I2 = ((NUMSEC/60 - (HOUR *60)));
HHMMSS/I6= INT( NUMSEC/3600 ) * 10000
+ INT( IMOD(NUMSEC,3600,'I4')/60 ) * 100
+ IMOD(NUMSEC,60,'I2');
TIME/A8=EDIT(HHMMSS,'99:99:99');
END
TABLE FILE CAR
PRINT CAR TIME
END
I get 00:04:04 as well (on 5.3.2)
February 13, 2008, 02:36 PM
LOgleMaybe I am not understanding how to do this. I need the time from my field FROM to populate the Converted Time field. The information is in the Field From When I do my report I need the seconds to show up in HHMMSS Where in my code do I need to make the change? Obiously my code will not be NUMSEC/I4 With Car do I need to Put NUMSSEC/I4 With Patient?
February 13, 2008, 02:45 PM
LOgleI am getting closer I put my field FROM in place of the 244 but my time for 780 printed as 00:13:00 and it should print as 1:00 pm
February 13, 2008, 03:00 PM
PrarieHere is some code I have...no time to change to you...but you can get the idea
Surely there is a better way...
TIME1/A6 = EDIT(STARTTIME);
TIMELEFT/A2 = EDIT(TIME1,'$$99$$');
TIMERIGHT/A2 = EDIT(TIME1,'$$$$99');
TIME2/A6 = TIMELEFT | ':' | TIMERIGHT;
HRS1/I2 = EDIT(TIMELEFT);
HRS2/I2 = IF HRS1 GT 12 THEN HRS1 - 12 ELSE HRS1;
AM/A2 = IF HRS1 GE 12 THEN 'PM' ELSE 'AM';
HRS3/A2 = EDIT(HRS2);
NEWTIME/A7 = HRS3 | ':' | TIMERIGHT | AM;
MORETIME/A7 = HRS3 | ':' | '00' | AM;
THISTIME/A7 = IF MORETIME EQ '00:00AM' THEN '12:00AM' ELSE MORETIME;
| In Focus since 1993. WebFOCUS 7.7.03 Win 2003 |
February 13, 2008, 03:27 PM
Francis MarianiHere's another method, using Date-Time fields.
FILEDEF PATIENT DISK activity.txt
-RUN
-WRITE PATIENT John Doe 615 887-0000 20080215 540 ACTIVE
-WRITE PATIENT Jane Doe 615 641-0000 20080215 540 ACTIVE
FILEDEF MASTER DISK patient.mas
-RUN
-WRITE MASTER FILENAME=PATIENT, SUFFIX=FIX
-WRITE MASTER SEGNAME=PATIENT
-WRITE MASTER FIELDNAME=FIRST, FORMAT=A8, ACTUAL=A8, $
-WRITE MASTER FIELDNAME=FILL1, FORMAT=A1, ACTUAL=A1, $
-WRITE MASTER FIELDNAME=LAST, FORMAT=A8, ACTUAL=A8, $
-WRITE MASTER FIELDNAME=FILL2, FORMAT=A1, ACTUAL=A1, $
-WRITE MASTER FIELDNAME=HOMEAREA, FORMAT=A3, ACTUAL=A3, $
-WRITE MASTER FIELDNAME=FILL2, FORMAT=A1, ACTUAL=A1, $
-WRITE MASTER FIELDNAME=HOMEPHONE, FORMAT=A8, ACTUAL=A8, $
-WRITE MASTER FIELDNAME=FILL2, FORMAT=A1, ACTUAL=A1, $
-WRITE MASTER FIELDNAME=DATE, FORMAT=A8YYMD, ACTUAL=A8, $
-WRITE MASTER FIELDNAME=FILL2, FORMAT=A1, ACTUAL=A1, $
-WRITE MASTER FIELDNAME=FROMM, FORMAT=I3, ACTUAL=A3, $
-WRITE MASTER FIELDNAME=FILL2, FORMAT=A1, ACTUAL=A1, $
-WRITE MASTER FIELDNAME=STATUS, FORMAT=A6, ACTUAL=A6, $
-RUN
DEFINE FILE PATIENT
CURR_DATE/HYYMD = HINPUT(14, '&YYMD.000000', 8, 'HYYMDS');
FROM_TIME/HHIS = IF FROMM GE 0 THEN HADD(CURR_DATE, 'SECOND', FROMM, 8, 'HYYMDS') ELSE CURR_DATE;
END
-RUN
TABLE FILE PATIENT
PRINT
FIRST
LAST
HOMEAREA
HOMEPHONE
DATE
FROMM
STATUS
FROM_TIME
END
-RUN
I had to rename the field FROM to FROMM - I was getting an error, it appears FROM is a reserved word.
CURR_DATE is a date-time field with the current date - this is used temporarily. The value evaluates to today's date with 0 hours minutes seconds - 2008/02/13 00:00:00.
FROM_TIME is date-time field in Hours:Minutes:Seconds format. FROMM is added to CURR_DATE to determine the time that FROMM represents. It is assumed the FROMM is the number of seconds, though I have not seen this confirmed by you. If it's minutes, then simply change SECONDS to MINUTES. This is the field you are interested in.
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
February 13, 2008, 03:29 PM
Francis MarianiI forgot to mention that the -WRITE statements are setting up the data and Master of your PATIENT file.
Also, you can change the format HHIS to HHISa to get am/pm displayed.
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
February 14, 2008, 04:17 AM
GamPquote:
NUMSEC/I4 WITH PATIENT = '';
Maybe it helps if you equate the field NUMSEC to something that actually has a value. With the code above, the value of the field will always be 0.
GamP
- Using AS 8.2.01 on Windows 10 - IE11. |
| in Focus since 1988 |
February 14, 2008, 09:44 AM
jgelonaLOgle,
Seems to me that your time field is not a time field, but an interger representing the number of minutes not seconds. If your time field is NUMMIN and contains 780, to convert this to "01:00 pm", do the following:
HOURS/I2=NUMMIN/60;
MINUTES/I2=NUMMIN-(HOURS*60);
AMPM/A3=IF HOURS GE 12 THEN ' pm' ELSE ' am';
DHOURS/I2=IF HOURS GE 12 THEN HOURS-12 ELSE HOURS;
DTIME/A8=EDIT(DHOURS) | ':' | EDIT(MINUTES) | AMPM;
Your input shows a FROM 540, which also seems to be minutes. This would convert to 9:00 am.
Actually, you could make this a function using the DEFINE FUNCTION if you needed to do this a lot.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
February 14, 2008, 05:30 PM
LOgleJgelona
It Works Now! Thank you sooo very much! I did this:
Define file Patient
DTIME/A8=EDIT(DHOURS) | ':' | EDIT(MINUTES) | AMPM;
END
TABLE FILE PATIENT
PRINT
'PATIENT.PATIENT.FIRST'
'PATIENT.PATIENT.LAST'
'PATIENT.PATIENT.HOMEAREA'
'PATIENT.PATIENT.HOMEPHONE'
'APPOINT.APPOINT.DATE'
'DTIME'
'PATIENT.PATIENT.STATUS'
V. 762
Windows XP
November 28, 2013, 04:58 PM
cs_sourceHave a question, i'm trying to convert minutes into HH:MM:SS as well and i'm using this logic and i have found that when i set the variable NUMSEC as the original poster shows this all works however when i try to use a value from another variable which i processed earlier in the report it doesnt????
Code i'm referring to:
NUMSEC/I4 = 164;
HHMMSS/I4= INT( IMOD(NUMSEC,3600,'I4')/60 ) * 100 +IMOD(NUMSEC,60,'I2');
TIME/A8=EDIT(HHMMSS,'99:99');
output 02:44 which is what i'm looking for (without pm/am)
My Example (becuase the minutes could be dynamic....)
REPORT_MINUTES/I6 = MINS;
HHMMSS/I4= INT( IMOD(REPORT_MINUTES,3600,'I4')/60 ) * 100 +IMOD(REPORT_MINUTES,60,'I2');
TIME/A8=EDIT(HHMMSS,'99:99');
output 00:00
the value that is in report_minutes is 164, now if i manually type 164 into NUMSEC or REPORT_MINUTES it all works? is there some internal conversion going on here? i'm displaying the value of what is in report_minutes and it is indeed 164...?
WebFocus 8.02, SQL Server 2008r2
December 02, 2013, 04:11 AM
GamPWhat's the format of your MINS field?
Maybe you meant it to be &MINS - thereby making it a DM variable?
GamP
- Using AS 8.2.01 on Windows 10 - IE11. |
| in Focus since 1988 |
December 02, 2013, 09:32 AM
cs_sourcequote:
our MINS fiel
hi GamP,
I have tried both integer and decimal and no luck, here is the code before i use that field:
PER/D8.2= (CNT_RECORD_AMOUNT * .9) + .5;
PER_RECORD/I8=90_PER;
PER_VALUE/I5 =IF RECORD_NUMBER EQ PER_RECORD THEN PAT_MINS ELSE 0;
-* this is where i have tried both integer and decemial
REPORT_MINUTES/D8.2 = PER_VALUE/60;
REPORT_MINUTES/I6 = MINS;
HHMMSS/I4= INT( IMOD(REPORT_MINUTES,3600,'I4')/60 ) * 100 +IMOD(REPORT_MINUTES,60,'I2');
TIME/A8=EDIT(HHMMSS,'99:99');
WebFocus 8.02, SQL Server 2008r2
December 02, 2013, 10:29 AM
Francis MarianiThis seems to work for me, the correct time in minutes and seconds is calculated:
TABLE FILE CAR
PRINT
COMPUTE REPORT_MINUTES/I6 = WEIGHT;
COMPUTE HHMMSS/I4 =
INT( IMOD(REPORT_MINUTES,3600,'I4') / 60 ) * 100 +
IMOD(REPORT_MINUTES,60,'I2');
COMPUTE TIME/A5 = EDIT(HHMMSS,'99:99');
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
December 02, 2013, 01:42 PM
Nick HiltIf you need it as a time value so that you can sort it:
TABLE FILE CAR
PRINT
WEIGHT AS 'Seconds'
COMPUTE T1/HHISa MISSING ON = HADD(DT(0), 'ss', WEIGHT, 8, T1); AS 'Seconds as Time'
LENGTH AS 'Minutes'
COMPUTE T2/HHIa MISSING ON = HADD(DT(0), 'mi', LENGTH, 8, T2); AS 'Minutes as Time'
END
Keep in mind what will happen if your times hit 24 hours or more.
WebFOCUS 7.6.7
Linux
HTML, Excel, PDF