big issue in web client

Hi guys,

For several weeks we had a BIG issue with the web client.

If you have some calculations used as dataproviders on some forms and if in those calculations you use a relation that is based on a global, and if you set that global in the calculation things WILL go wrong. Not always BUT sometimes they will go wrong: that form will not load.

So pay attention to this. This occurred in 5.2.7.

Maybe this will help someone!

That looks like you created an infinite loop there.

Can you post you calculation? Then we can see what goes wrong.

Hi,

Here is the calcualation

globals.exs_dutyline_duty_date = duty_date
var $valid_benefit_with_function = false
var $fs = dty_duty_line_to_emp_work_agreement
if (utils.hasRecords($fs)) {
if (utils.hasRecords($fs.emp_work_agreement_to_emp_benefit$duty_date)) {
var $fs2 = $fs.emp_work_agreement_to_emp_benefit$duty_date
$valid_benefit_with_function = ($fs2.function_id != null)
}
}

in the relation emp_work_agreement_to_emp_benefit$duty_date I am using the global defined above.

This produces the problem

domnulnopcea,

What happens is that the calculation depends on the global.
When the same calc runs on another record the global is changed and the first calc is flagged for recalculation.
When it runs for the next record, the global is changed again and both 2 previous calcs are flagged.
Etc.

Basically you need relation with arguments in stead of the using the global, this was also discussed here: viewtopic.php?t=15513
Has anyone already created a feature request already?

In your case you can solve this by using a relation on the duty_date field in stead of the global.

Rob

yes, I see your point!

But still there should be some control here…

This should work fine and the calculation engine should be smarter (my opinion).

If you are on a form and it has 10 records when you just simply display the list this should not get into in infinite loop (my opinion)

setting any other variable in a calculation is just not allowed.
That’s a big nogo.

Calculations are just for getting one piece of value, their own. They must not set anything else.

Also calculations are even executed at the same time if for example you show it in a tableview… What happens then if you are constantly setting a global?
So they are not executed in sequel but in parallel so one calc can see the global value of another calc…