
Re: A little help with the maths please (base 100 to 60)
Dave Riley Nov 6, 2012 6:01 AM (in response to Göran Hofstedt)Hi,
It's probably easier to convert the values to minutes, do the sum and convert back, as follows in the load script...
Hours:
LOAD *, (subfield(Duration,'.',1)*60) + subfield(Duration,'.',1) as Minutes INLINE [
Duration
0.15
0.45
0.59
1.35
1.50];
Calculations:
Load Duration, Duration Minutes*(Rand()*250) as RandomSum resident Hours;
SET base60conv = Floor(Floor(RandomSum)/60) & ' hrs ' & num(floor(RandomSum  (Floor(RandomSum/60)*60)),'00') & ' mins';
In this example you could either put the conversion back to your desired format direct in the expression or as I have set as a variable and use =$(base60conv)
flipside
EDIT: My mistake, should multiply Minutes not Duration  fixed.

Re: A little help with the maths please (base 100 to 60)
Göran Hofstedt Nov 6, 2012 6:55 AM (in response to Dave Riley)Oh, thanks. But I´m not shure how I should use the variable in a expression?

Re: A little help with the maths please (base 100 to 60)
Dave Riley Nov 6, 2012 7:02 AM (in response to Göran Hofstedt)The variable is just shorthand for the expression, so whatever the variable is set to will be calculated as if the variable value had been input as the expression instead.

Re: A little help with the maths please (base 100 to 60)
Göran Hofstedt Nov 6, 2012 8:57 AM (in response to Dave Riley)I ran into truble when the field are a integer, 200 becomes 12200 and not 12000. Can I somehow correct that?

Re: A little help with the maths please (base 100 to 60)
Dave Riley Nov 6, 2012 9:06 AM (in response to Göran Hofstedt)Yeah, when the decimal part is missing it will add the integer part on again. Quickest way is to format the number to force include a decimal part, something like ...
LOAD *, (subfield(num(Duration,'0.00'),'.',1)*60) + subfield(num(Duration,'0.00'),'.',1) as Minutes INLINE [
flipside

Re: A little help with the maths please (base 100 to 60)
Göran Hofstedt Nov 8, 2012 6:47 AM (in response to Dave Riley)Hi
Did not have time to respond yesterday but unfortunately that did´t work. The integer are god but the decimal numbers now converts to 0...

Re: A little help with the maths please (base 100 to 60)
Dave Riley Nov 8, 2012 7:01 AM (in response to Göran Hofstedt)Try the num format to 0,00 rather than 0.00  difference is due to different locales.
EDIT: This might also be worth trying ...
LOAD *, (subfield(num(Duration,'#,##'),chr(44),1)*60) + subfield(num(Duration,'#,##'),chr(44),1) as Minutes INLINE [
chr(44) =comma

Re: A little help with the maths please (base 100 to 60)
Göran Hofstedt Nov 8, 2012 8:45 AM (in response to Dave Riley)Ah, really nice of you to help me! the last suggestion worked brilliant, thanks






