Rense Posted July 14, 2009 Posted July 14, 2009 I have: (ORDERS) orderID relationID Name Description TotalTimeWorked (HOURS) hourID employeeID orderID [10] TimeWorked [10] Date TotalTime I want to calculate in field orders::TotalTimeWorked howmany hours the employees have worked on an order. If I use Sum(HOURS::TimeWorked) it works fine untill an employee works on 2 order in one day and it also adds the hours worked from the other order.
IdealData Posted July 14, 2009 Posted July 14, 2009 Unfortunately you haven't described the HOURS::TimeWorked relationship sufficiently, however I'll guess you don't have orderid as part of the relationship, hence why the SUM function is adding all orders together. When you make orderid part of the relationship then you will be able to distinguish between different orders.
Rense Posted July 14, 2009 Author Posted July 14, 2009 the only relation line between the 2 tables is between the orderID's
IdealData Posted July 14, 2009 Posted July 14, 2009 In that case then the orderID in the HOURS table must be the same number for both orders - check the data in the HOURS table.
Rense Posted July 15, 2009 Author Posted July 15, 2009 I think the problem is that its a repeating field. It works like this: Our employees can log in and fill in a day chart wich is based on the HOURS::Date They can fill in that they worked for x number of hours on an order, its possible that someone works in one day on 10 different orders, hence the repeating fields to 10. In the HOURS::TotalTime it adds up all the hours the employee has worked on a day (this works). In the ORDERS::TotalTimeWorked I want to see howmany hours the employees have worked on that order. My calculation workes when all the employees fill in their chart with only one order When they fill in that they worked on 2 orders in one day the calculation goes wrong and also adds in the hours worked from the 2nd order they worked on. Hope this makes my problem a bit more clear.
Søren Dyhr Posted July 15, 2009 Posted July 15, 2009 Try to work yourself thru this thread: http://fmforums.com/forum/showtopic.php?tid/196814/post/297466/#297466 Where several templates shows how to turn away from repeaters when "hours worked" is the topic. --sd
IdealData Posted July 15, 2009 Posted July 15, 2009 I noticed your repeating fields but didn't think you were using them in the way described. So, all the orders workeda re in actual fact under the same orderid - but in different repetitions. Now is a good time to realise the folly of repeating fields (except in some specific circumstances), especially when they can be so easily replaced with RELATED records.
Rense Posted July 15, 2009 Author Posted July 15, 2009 Ok I understand now that it's a big no no to use the repeating fields. The white paper made it really clear. Could you maybe help me on my way with the related record? MBA.zip
Søren Dyhr Posted July 15, 2009 Posted July 15, 2009 You overestimate our hacking skills by forgetting to give us password and account name. But if you download this template: http://fmforums.com/forum/attachment.php?attid/14164/ ...would you see each day have a cell open for entry, the data lands in a table a relation away - which means you can sum via the aggregate function Sum( over the relation. Now in the template are there only provisions for one assignment each day, but it's just a matter to prefab'e to a more granular solution with more records in the sandwich layer. --sd
Rense Posted July 15, 2009 Author Posted July 15, 2009 (edited) I'm not able to open the template now because I'm not at work atm, but no hacking skills required : Its just admin without a password. I'm still getting used to the way of working / thinking of FM but already loving the community : Good sharp feedback and fast, thanks already guys. Edited July 15, 2009 by Guest
Rense Posted July 17, 2009 Author Posted July 17, 2009 Anyone who can help me on my way on how to do this in my template? Any help will be welcome ;)
Rense Posted July 17, 2009 Author Posted July 17, 2009 I tried to start over and using a portal, but something is wrong because if I am using Lay-Out UrenDatums I cant add anything in the portal. admin and no password test.zip
Søren Dyhr Posted July 17, 2009 Posted July 17, 2009 Something easily forgotten before you get the hang of it.... --sd
Rense Posted July 17, 2009 Author Posted July 17, 2009 I was so busy focusing on avoiding the old problem I totally forgot the even think of that option thnx a lot ;)
Recommended Posts
This topic is 5667 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now