cancel
Showing results for 
Search instead for 
Did you mean: 

Formula to calculate Time that has condition.

Former Member
0 Kudos
91

Post Author: alexander_tze

CA Forum: Formula

hi everyone,

i'm new to crystal report 2008, wish that you all can help.

i'm trying to calculate some data from a database. Below was the example of the database.

ID Condition Time Floor

1 1 10:54:48 AM 12 1 10:54:48 AM 29 0 10:55:02 AM 210 0 10:55:16 AM 1

With these database, i'm going to calculate the time for each floor ( floor 1 and 2) with the condition "1" and "0"( "1" for start time and "0" for end time). below was the basic theory for the calculation

(Floor 1 with time (10:54:48) and condition="0" ) - ( Floor 1 with time (10:55:16) and condition="1" )

and the result should be 18 second.

The same theory goes to floor 2(Floor 2 with time (10:54:48) and condition="0" ) - ( Floor 2 with time (10:55:02) and condition="1" )

hope that you guys can help me to create a formula for these "time calculation"

Accepted Solutions (0)

Answers (13)

Answers (13)

Former Member
0 Kudos

Post Author: pandabear

CA Forum: Formula

Hey alexander,

There's so much info that's needed for this problem, so I'm going to make some assumptions and

give you a possibility. Crystal is a hierarchal (spelling?) animal. When it makes calculations, it

does it from the top down. If the final number for your chart is in the footer, you cannot put the chart

ABOVE that footer and get the final number. e.g. you chart shows the wrong number.

Solution: Process all the numbers in the query; that way you can put the chart any place you want.

If you can't write this query, then try to get someone who can.

The formula you present in the beginning cannot work because the condition "0" or "1" returns 0 data

on the examples you show. If this is part of the real data, you need to change the formula filters.

It's a shot in the dark, but I really hope this helps,

The Panda

Former Member
0 Kudos

Post Author: alexander_tze

CA Forum: Formula

Hi guys,

Any solution for this problem? i realy want to know the formula on how to calculate the "time" based on that database. if you all have the solution, please shared it with me...

Former Member
0 Kudos

Post Author: alexander_tze

CA Forum: Formula

i have sent you an e-mail

Former Member
0 Kudos

Post Author: V361

CA Forum: Formula

I sent you a private message.

Former Member
0 Kudos

Post Author: V361

CA Forum: Formula

You can send me a private note in the forum, (look for Inbox) I will respond with my email. When you send the rpt, be sure to check the save data option. (File, report options, save data with report)

Former Member
0 Kudos

Post Author: alexander_tze

CA Forum: Formula

Hi,

My chart was place on the Group Header mean while the formula was placed on the report footer and the value still return "70.00" . For this chart,the formula was taken from fomula editor and assigned in the "Show value" on chart expert. Did i miss something here?

Previousely, i have placed my chart on Report header and using a formula to calculate the "time" directly in "Show Value" on report expert, but the result still the same(70.00 for each value). Please let me know if you have the solution for this problem. i am still not good enough using this software. wish that i can contact u directly (via e-mail or whatever) and send the copy of my chart to you. Thanks.

Former Member
0 Kudos

Post Author: V361

CA Forum: Formula

Where in the report did you place the formula? , and the chart ?

Former Member
0 Kudos

Post Author: alexander_tze

CA Forum: Formula

Hi guys,

Thanks for the tips, i appreciate it, but it still cannot be used to create my chart. I have tried it and it's return the "70.00" value for each value of the chart (calculation of max-min). Any other tips or formula that can be applied to create my chart or you guy know any others formula....

Below formula cannot be used but if someone know how to transform it into others way you are most welcome.

formula 0 :(tbl.condition) = "0" then (tbl.time, tbl.floor)

formula 1 :(tbl.condition) = "1" then (tbl.time, tbl.floor)

condition 0 - condition 1

Former Member
0 Kudos

Post Author: pandabear

CA Forum: Formula

Hi Alex,

I think V361 might be right. Create the formula's as he said and then

use the results to plug into the data section of your chart.

Former Member
0 Kudos

Post Author: alexander_tze

CA Forum: Formula

hi,

Thanks for the tips, but i dont think that is the solution for this problem. any other ideas? i just want to create a chart only. Actuall the chart will be look base on below charting format

on change of " floor, condition"

show " time" <----actually this is the result after the calculation.(Time with condition "0" substract by Time with condition "1").

i was stuck here. wish you guys can help.

Former Member
0 Kudos

Post Author: V361

CA Forum: Formula

Create your groups, then in the group footer, put a formula (using whatever your time stamp name is.)

Maximum Minimum

you can then use another formula to subtract your minimum from the max. you could also just use this as one formula

Maximum - Minimum, you should be able to use the formula result in your graph.

Former Member
0 Kudos

Post Author: alexander_tze

CA Forum: Formula

Hi there,

Thanks for the tips, but i'm not clear with your information. Could you please tell me more detail regarding that calculation formula...and one more thing, the result for this calculation actually will be used to create a chart only.

The chart will be based on count of time(after the calculation) by condition and floor.

Former Member
0 Kudos

Post Author: V361

CA Forum: Formula

I don't have 2008, but you should be able to group by condition then by floor, you can do a maximum time formula, and a minimum time formula, and then do the subtraction based on those.... that should work.