ConversionFunction

ConversionFunction

  
Hello

I Have two values the first : data type is time for eg 2h:45:12 and the second: data Type Integer eg 112 so what i want is to create function for calculate     2h:45:12 * 112 but i receive an error Incompatible data type
in operator * (text;integer) then i used this conversion function IntegerToText but stil error.. 

thanks
Confused what you actually want to achieve, buta ssuming you want to multiply the datetime.

Create a custom action DateTime to seconds, then multiply it with 112.

I have to multiply two values datetime and Integer how can make it ?
 I already have the DateTime Value so i dont need to create it, what i want is how can i multiply it whith Integer value thanks for your quik reply

best cheers

As J was tryng to say, multiplying a time with an integer doesn't really make sense until you convert that time to an integer with the number of seconds in the time value (9912 seconds in your example) then multiply by 112 and then convert back to hours, minutes and seconds.  If you need to save this value you'll also have to save it as an integer in seconds because I don't believe the time value can exceed 24 hours.

Hope this helps,
Curt
Hi Curt 
Can you make me an exemple please because i cannot convert Time to Integer,then i don't realy understand how can i resolve this issus .
ActiviteForm.Record.Activites.TempsConsacre * Engins.Cout_Horaire
knowing that TempsConsacre :Time  and Cout_Horaire :Integer
thanks
Here's a simple example that will give you the number of seconds.

Hour(ActiviteForm.Record.Activites.TempsConsacre)*3600+Minute(ActiviteForm.Record.Activites.TempsConsacre)*60+Second(ActiviteForm.Record.Activites.TempsConsacre) * Engins.Cout_Horaire
There is some thing missing have a look at this attachement please
Fati Zahra wrote:
There is some thing missing have a look at this attachement please
Its seems that ActiviteForm.Record.Activites.TempsConsacre is a text and not a Datetime. First you need to convert it to Datetime.

Hour(TextToDateTime(ActiviteForm.Record.Activites.TempsConsacre))*3600+Minute(TextToDateTime(ActiviteForm.Record.Activites.TempsConsacre))*60+Second(TextToDateTime(ActiviteForm.Record.Activites.TempsConsacre)) * Engins.Cout_Horaire 
 
This may work (if TemsConsacre is a Text and the value is a correct Datetime), but suggest that you create a action (set it function) and calculate your formula there. Perhaps add some cache time. 
Hi,

Still didn't get what is the objective of all this.
Fati, can you tell us what is the use case of what you are trying to do?
What is the result that you expect from "2h:45:12 * 112" and where will you use the value on after?


Regards,
João Rosado
João Rosado wrote:
Hi,

Still didn't get what is the objective of all this.
Fati, can you tell us what is the use case of what you are trying to do?
What is the result that you expect from "2h:45:12 * 112" and where will you use the value on after?


Regards,
João Rosado
 Hi Joao

I'm trying to calculate the work force of operator of my companie, i think this function it work
Hour((Activites.TempsConsacre))*3600+Minute((Activites.TempsConsacre))*60+Second((Activites.TempsConsacre)) * Engins.Cout_Horaire 
 but when i assing it and want to get it on my table record i found null value !!!
Hello 

ok it's done, thank you for all of you

best regards