Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shifting values in detail section 1

Status
Not open for further replies.

gmman

Technical User
Feb 14, 2004
26
US
I am not sure this can be done but let me try to explain.

This the kind of output I am getting, but I want to shift the times down and put the start time in the first position. I am adding the minutes to the time. This is done in the detail section.

Time Description of activity Time Required
in Minutes
10:50 Start of job 2
11:00 xxxxxxxxxxxxxxxxxxxxxxxxx 10
11:15 xxxxxxxxxxxxxxxxxxxxxxxxx 15
End of job

This is what I am trying to get:

Time Description of activity Time Required
in Minutes
10:48 Start of job 2
11:50 xxxxxxxxxxxxxxxxxxxxxxxxx 10
11:00 xxxxxxxxxxxxxxxxxxxxxxxxx 15
11:15 End of job


The time is calculated from start field (10:48) then added to the minutes. I am trying to get start time for each operation. Each operation has a field numbering it 1,2,3 etc.

Thanks for any help
 
If the time formula currently is something like:

dateadd("n", {#mins}, {table.start})//where {#min} is a running total of {table.mins}

...then I think you could change the formula to:

dateadd("n", {#mins}-{table.mins}, {table.start})

If this doesn't work, please share the exact formula currently used for the time column.

-LB
 
That didn't work here is the formula:

dateadd("n",{#Running Total},{WORKORDER.REPORTDATE})



I thought I might have to set up some if statements to get it to shift the times.

I was out of the office yesterday so that is why this reply is late.

Thanks
 
Well, I think my suggestion should work. Please show an example of what your results currently are, then what they are when you use my suggestion, and then what the results should be.

-LB
 
After your suggestion I realized that I had used one wrong field. Changed that and it worked great.

Thank you very much
 
One more thing that I don't understand. for some reason the first figure is not right, when it should be adding 2 min it only adds 1 min. I did a work around and made it work but was just wondering why it is always wrong

Time Description of activity Time Required
in Minutes
10:48 Start of job 2
10:49 xxxxxxxxxxxxxxxxxxxxxxxxx 10
10:59 xxxxxxxxxxxxxxxxxxxxxxxxx 15
11:14 End of job


dateadd("n",{#Running Total}-{@Time Setup},{WORKORDER.REPORTDATE})

To get it to work right I had to change it to the following:

if {WPOPERATION.WPOPERATION}=1 then{WORKORDER.REPORTDATE} else
dateadd("n",1+{#Running Total}-{@Time Setup},{WORKORDER.REPORTDATE})
 
That is odd. What's in {@Time Setup}? I'm assuming that {#running total} was created with the running total expert.

-LB
 
I had to do a conversion, the opduration field is in tenths of an hour so I had to convert to minutes with this formula:

60*{WPOPERATION.OPDURATION}

if you look at raw data from opduration it looks like this:

2 min = 0.0333333
10 min = 0.1666667
15 min = 0.25000

After I convert then I do the running total
 
Okay, the issue is that the dateadd function seems to require a whole number for the calculations in the second argument, and when there is a decimal, it truncates the number. You can see this by creating two formulas:

//{@time}:
currentdatetime

//{@dateaddtest}:

dateadd("n", 1.99, currentdatetime)

This adds one minute onto the datetime, but if you change the value to 2, it adds two minutes. The solution is to change {@Time Setup} to:

round(60*{WPOPERATION.OPDURATION})

Do not use your workaround, since it will not correct for other decimal values that occur.

-LB
 
That worked perfect!!!! Thanks for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top