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.
My time field shows as 780, I need this to convert to an HHMM field,ie 1:00 pm. I am able to find converting a date/time filed but this is just a time field. I have tried some of the suggestions on the date/time page but cannot get this to work. Any suggestions?
Thanks!This message has been edited. Last edited by: <Kathryn Henning>,
Well, 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?
GamP
- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007
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
Maybe 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?
Here 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
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005
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
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.
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006
Have 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????
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...?
If 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.