Hi!
So, I am doing a app to keep on track my taks and, if the task is for work, I am adding a payment attribute.
So, when I finish my task, I save the duration and I say Custos = Custos / 60 * DataFim
Custos is my payment for hour (5€ per hour, example) and DataFim is the time that I used to finish the task.
I think that the error is in the showing of the decimal but I am not sure.
I hope you can help me and if u need more prints, tell me :)
Hello Gonçalo,
Hope you're doing well.
What exactly is the error that you're facing? Can you give us more detail?
Kind regards,
Rui Barradas
Hey Rui
As you can see, I start my Custos at 5€ and when I change the task state to "Feito!" it should do (5 / 60 * Minutes (that i used) but it always sets Custo to 0
Can you share your OML file, please?
Here you go :)
Thank you for sharing your OML.
The first thing that I can see is that you're using Input Parameters to store Local Variables.
For example, your input parameter Data of the UpdateTasks server action should be a Local Variable, since you're using CurrDateTime(). There is no need to have it as an input parameter. The same thing applies for DataFim.
Also, if you want to use these values and update your database with them, you should have the Assign widget before the Update, and not after :)
This will allow you to use those variables in your UpdateTasks SQL:
Finally, you should review your Custos value. If Custos input parameter is 0, this will lead to always having 0 as a result of that calculation.
Most likely, you want to filter your query GetTasks to pick the record with a value and use this value in further calculations:
Hope that this helps you!
Hwy Rui! I already changed the input parameters and the SQL but I didn´t understand the last part? How can be Custos be 0? I always insert a value bigger than 0 and when I update the tasks, Custos value changes
Maybe the error is on this part
Hello again Gonçalo,
Yes, I also believe that the error is there :)
Because you are receiving Custos as an input parameter for UpdateTasks server action and it is defined as:
GetTasks.List.Current.Task.Custos
And then you use this value to do this calculation in UpdateTasks:
Custos = Custos / 60 * DataFim
So it will return 0 if GetTasks.List.Current.Task.Custos is 0.
That's why I you need to check your query GetTasks to pick a record with a value for Custos (table attribute) and use this value in further calculations. Because if you pick a record with 0, the calculation will return 0 as mentioned above.
Hey Rui, sorry for being annoying but I am having another problem now. Custos is working now but everytime I set a task to Feito!(done) it changes all DataFim(DiffMinutes) and all Custos to the last that he calculated instead of only changing the one tha was updated.
You can sse that "Duração da tarefa"(DataFim) should be 2 but it is 4, for exempleHope you can help me, if you want I can send you the OML file
Glad to see that your original problem is solved now :)
As I can see, you created another thread for this last question: https://www.outsystems.com/forums/discussion/67235/my-database-is-changing-all-data-instead-of-only-one/
So I suggest that you close this one and focus on the other one with this different question to avoid multiple discussions about the same issue.
HI Goncalo,
You are getting data from task entity and pass this input in Update action
and task entity have 0 value for Cutos (cost)
that why you getting always 0 value .
Hope this will help you.
Regards
Rahul