Q

Columns displaying wrong decimal from calculation

Web Development

Looking for something else?

+ Show More
I have a view that displays imported employees attendance documents from a .txt file. This view has columns, a couple of which are hours and minutes. When I try calculating hours + minutes for each individual employee, I get the correct total figure in decimal format, just a little off. For example, if an employee worked 7.5 hours, the column will display 7.67.

How can I get the column to display 7.5 hours instead? The formula that I am using in the column is:

```@Sum(minutes)/60 + @Sum(Hours)
```
Your help with this is greatly appreciated.
Assuming the Hours field contains 7 and the Minutes field contains 30, I see no reason the result should be 7.67. Are you sure the Minutes field doesn't contain 40?

I don't understand why you use @Sum. Are these multivalued fields? If not, @Sum doesn't do anything useful. If so, then what values are you using to represent 7.5 hours?

If the fields are multivalued and Minutes contains, say, 30 and 10, then the formula is returning the correct result.

Use the document properties box from a view (highlight a document and press Alt+Enter) to see the actual values of these fields (on the second tab of the dialog). It might be that they don't have exactly the values that you think they do.

Member clarification:
Andre, first I would like to thank you for taking the time to read and answer my e-mail. Somehow though, there was some misunderstanding that may have been caused by my explanation.

I have a form "TATC" and on that form I have many fields, among those fields are two field "hours" and "minutes." The value of all the fields on the forms is imported from a .txt file and saved into the document. As these documents are attendance documents, each employee will have at least four documents per day, in which case I need to total the amount of hours worked per that day. When I try to display the daily total `@Sum(minutes)/60 + @Sum(Hours)`, which give me the minutes in decimal value as a portion of a hundred. I have no problem with the hours because as soon as the minutes portion hits 100% (equivalent to 60 minutes) then the hour is added to the hours.

My question was: Instead of the value of minutes display in decimal (portion of 100% of 60 minutes), I just want to display as is. For example, when an employee has worked 7 hours and 30 minutes, I would like to column to display 7.5 (.5 being half of the hour or 30 minutes from the 60 minutes of the hour).

I am so sorry for my lengthy explanation, and I hope that it help you to understand the problem better. I have tried many ways to go around the problem by using @int and integer functions and so on, but nothing worked.

Thank you in advance.

Andre's response:
I still don't exactly understand what you're doing. I tried what I think you are describing, and I don't get 7.67 as a total. Perhaps I can explain to you what I did, and you can tell me how your situation is different.

I created a sample database that contains one form, Timecard, and one view. Each Timecard document contains one Hours number and one Minutes number.

The view contains a column with the formula `@Sum(minutes)/60 + @Sum(Hours)`. The @Sum doesn't actually do anything useful, since there is only one number in each document to sum. So I could have used this formula instead, and it would do the same thing: `Minutes/60 + Hours`

Here's what the view looks like:

Donald Duck worked 7 hours and 30 minutes, and the correct number 7.50 is displayed. This column also displays totals, so Roy Blount, who worked a total of 6 hours and 90 minutes stored in four separate documents, also has a correct total value 7.50 is displayed. I don't know where you're getting 7.67.

One thing you might want to do is examine the properties of the individual documents to make sure you know exactly what values they contain and what their datatypes are. Highlight a document in the view, and open the properties dialog by pressing Alt+Enter. Here's the tab that shows field information. Notice the Data Type of the field, which should be Number, and the value -- 5 in this case.

This was last published in February 2005

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

SearchWindowsServer

• Windows Server Migration Tools make file share moves less taxing

Administrators can hit a few snags when migrating a Windows file server, but a free Microsoft utility and some PowerShell ...

• Tailor a WSUS server setup to any Windows environment

Administrators can configure a Windows Server Update Services server -- or several -- to manage and distribute updates from ...

• Microsoft SCORCH lights an automated path to more efficiency

System Center Orchestrator tackles tedious tasks and can even make autonomous decisions based on conditions set by the Windows ...

Search400

• iSeries tutorials

Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

• V6R1 upgrade planning checklist

When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

• Connecting multiple iSeries systems through DDM

Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

• SUSE Linux jumps on the open private cloud deployment train

SUSE Linux Enterprise planning private cloud deployment with OpenStack weight behind it. NVIDIA works on Linux drivers for ...

• Want one of the many Linux jobs out there? Time to go back to class

Does extended education from the Linux Foundation and others help graduates meet the demands of today’s Linux jobs? Some say yes.

• Ubuntu ARM server AMI for Amazon EC2 offers fast access in the cloud

Canonical’s Ubuntu ARM server AMI for Amazon EC2 provide open source shops with a fast ARM server for the cloud.

SearchDataCenter

• Build a data center shutdown procedure to prepare for the worst

A data center shutdown checklist helps IT teams focus on backup, testing and system verification before pulling the plug and ...

• Telcos purge colocation data centers, open door to neutral connections

Enterprise customers in Verizon and CenturyLink's colocation data centers should expect better cloud and network connection ...

• IT slowly embraces composable infrastructure

If there will be a way to make an enterprise data center as efficient and optimized as cloud computing, composable infrastructure...

SearchExchange

• Access for Office 365 external users a concern for admins

Microsoft added external access for Office 365 Groups, which means administrators must contend with confidentiality and lifecycle...

• The essential admin's guide to Office 365 PowerShell

Need to make extensive updates quickly? Admins can rev up their PowerShell skills, bypass the Office 365 management GUI and leave...

• Understanding Exchange Online's Role-Based Access Control model

The Role-Based Access Control model manages and evaluates permissions in Exchange Online. Admins can explore the model, create ...

SearchContentManagement

• Microsoft brings its flavor of AI with Microsoft Cognitive Services

Microsoft Cognitive Services has a new array of APIs to make it easier to scan text, video and audio data and to bring ...

• Users prefer Office 365 suite collaboration features over SharePoint

Users don't want to jump through hoops, and they want applications to work on mobile devices. Those needs may kill traditional ...

• What new SharePoint features to expect in the next 12 months

Now that Microsoft is developing its SharePoint features, there are new feature rollouts all the time. Here's a rundown of the ...

Close