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     [CLOSED] how to calculate in hours

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] how to calculate in hours
 Login/Join
 
Gold member
posted
Hi

i have data like this
Duration/D20.2(field format)
5.50
1.00
0.00
2.00


i want to calculated in hours
can one plz give me with example

Thanks

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


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 51 | Registered: December 01, 2010Report This Post
Guru
posted Hide Post
What do the data you have shown represent? Is the duration expressed as minutes or seconds or hours or days?


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Expert
posted Hide Post
We can point you in the right direction if you give us a bit more to go on here...

I'm guess that these number are equivalent to time (5.5 = 5:30 (am or pm?))
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Gold member
posted Hide Post
quote:
Originally posted by jimster06:
What do the data you have shown represent? Is the duration expressed as minutes or seconds or hours or days?


  

Its represent hours and minutes 






WebFOCUS 7.6
Windows, All Outputs
 
Posts: 51 | Registered: December 01, 2010Report This Post
Guru
posted Hide Post
Help me out here.

Does the 5.50 value represent five and one half hours?

Or does it represent 5 hours and 50 minutes?

Or something else?


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Gold member
posted Hide Post
quote:
it represent 5 hours and 50 minutes?


it represent 5 hours and 50 minutes?


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 51 | Registered: December 01, 2010Report This Post
<JJI>
posted
Deepu,

This is infact very simple.

Here is an example. Just replace the &VALUE by your DB field.
  
-SET &VALUE = 5.50;


DEFINE FILE CAR
DFN_MINUTES/I11 = (INT(&VALUE) * 60 ) + ((&VALUE - INT(&VALUE)) * 100);
DFN_HOURS/D12.2 = DFN_MINUTES / 60;
END


TABLE FILE CAR
PRINT 

    SALES
   
BY COUNTRY 
BY CAR
HEADING
"&VALUE =  <DFN_MINUTES Minutes  =  <DFN_HOURS Hours"
""

END

This message has been edited. Last edited by: <JJI>,
 
Report This Post
Expert
posted Hide Post
Sorry JJI.

But, that results in: "5.50 = 350 Minutes = 5.83 Hours" which would indicate the 5.5 hours = 5.83 hours?
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
Consider this:
DEFINE FILE CAR
DFN_HOURS_IN/A2 = EDIT('&TIME_IN.EVAL','9') ;
DFN_MINUTES_IN/A2 = EDIT('&TIME_IN.EVAL','$99') ;
DFN_MINUTES_OUT/I2   = EDIT(DFN_MINUTES_IN) * 60;
DFN_HRS_MINS/A6 = DFN_HOURS_IN || ':' || EDIT(DFN_MINUTES_OUT) ; 
END
TABLE FILE CAR
PRINT SALES NOPRINT
HEADING
"&TIME_IN =  <DFN_HOURS_IN Hours and <DFN_MINUTES_OUT Minutes"
"OR, the time is ( <DFN_HRS_MINS ) "
ON TABLE SET PAGE OFF
END
-* this produces: 5.50 = 5 Hours and 30 Minutes 
-*                OR, the time is ( 5:30 )
Of course the parsing of the &TIME_IN needs to be adjusted for the hours and minutes potions to work properly... That's more then this example covers...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Guru
posted Hide Post
Or consider this:
[code]
-* File duration.fex
-SET &DUR_IN = 550;
-* Set test value
DEFINE FILE CAR
DUR_ALL/D20.2 = &DUR_IN/100;
-* Put in format same as OP's request
DUR_HRS1/I11 = INT (DUR_ALL);
-* Use INT function to get hours separate from minutes
DUR_MIN1/I11 = INT(DUR_ALL * 100) - (DUR_HRS1 * 100);
-* Isolate minutes
END
TABLE FILE CAR
SUM
DUR_ALL
DUR_HRS1
DUR_MIN1
MODEL NOPRINT
ON TABLE HOLD
END
-* Build hold file with sum of hours and minutes
DEFINE FILE HOLD
DUR_MIN2/I11 = IMOD(DUR_MIN1,60,DUR_MIN2);
-* Calculate minutes less than one hour using Integer Modulus function
DUR_HRS2/I11 = DUR_HRS1 + (DUR_MIN1/60);
--* Add one or more hours of minutes to origial sum of hours
END
TABLE FILE HOLD
PRINT
DUR_ALL
DUR_HRS1
DUR_MIN1
DUR_HRS2
DUR_MIN2
END
{/code]


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
<JJI>
posted
quote:
it represent 5 hours and 50 minutes


Doug,

Sorry, but as per Deepu comments 5.50 is equal to 5.83 hours. I agree if 5.50 ment 5 hours and 30 minutes then the reslut should be 5.50 hours.
 
Report 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     [CLOSED] how to calculate in hours

Copyright © 1996-2020 Information Builders