Forum Discussion
You don't need (and it's not allowed, so you get error) an additional update in the onBeforeUpdate method. Just change the properties of "this".
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:85f947e1-db8b-4ac3-9e72-db466925afe3:type=csharp&text=this.setProperty%28%22mp_dias_vac_restantes%22%2C%20vacDiasRestantes%29%3B%0D%0Athis.setProperty%28%22mp_dias_vac_apuntadas%22%2C%20vac_DiasApuntados%29%3B%0D%0Athis.setProperty%28%22mp_dias_vac_disfrutadas%22%2C%20vac_DiasDisfrutados%29%3B%0D%0Areturn%20this%3B]
And more likely you need link you method to onBeforeAdd too.
- team_aras_meupe_com3 years agoCreator III
Yes!!, its works!!!!. Thanks.
Now the problem is that when executing the method before saving the related table, the one below. Since the changes are not saved, they are not applied to the summation. If I press the save button twice, the second time it already applies the changes. Which is logical since the data is not yet saved.
Another question, to get the counter of the selected days I execute this AML:
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:7aa6b7c9-8484-4e68-903f-5aa5b0ed29b0:type=text&text=CodigoAML%20%3D%20%22%3CItem%20type%3D%27MP%20CONTROL%20PRESENCIA%27%20action%3D%27get%27%20returnMode%3D%27countOnly%27%3E%3Cmp_con_usr%3E%22%2BsourceID%2B%22%3C%2Fmp_con_usr%3E%3Cmp_tipo_inci%3EV%3C%2Fmp_tipo_inci%3E%3C%2FItem%3E%22%3B%0D%0Avar%20ResultadoControlP%20%3D%20innovator.applyAML%28%22%3CAML%3E%22%2BCodigoAML%2B%22%3C%2FAML%3E%22%29%3B%0D%0A%0D%0Aint%20vac_DiasDisfrutados%20%3D%20ResultadoControlP.getItemCount%28%29%3B%0D%0A]Is there a better way to get the data?.
Too many thanks!!!!
- alaxala3 years agoCreator III
If you get your vac_* values using AML query you get the old data as you code run before update. Changes are available as relationships of the "this". But changes only.
There was a similar question here some time ago. Maybe this help you.
- team_aras_meupe_com3 years agoCreator III
Thanks for showing me the way. Little by little I'm taking it forward.