big issue in web client

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

big issue in web client

Postby domnulnopcea » Tue May 17, 2011 12:21 pm

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!
domnulnopcea
 
Posts: 42
Joined: Wed Dec 10, 2008 3:26 pm

Re: big issue in web client

Postby Joas » Tue May 17, 2011 12:31 pm

That looks like you created an infinite loop there.

Can you post you calculation? Then we can see what goes wrong.
Joas de Haan
Yield Software Development
Need help on your project? yieldsd.com
User avatar
Joas
Site Admin
 
Posts: 842
Joined: Mon Mar 20, 2006 4:07 pm
Location: Leusden, NL

Re: big issue in web client

Postby domnulnopcea » Tue May 17, 2011 12:37 pm

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
 
Posts: 42
Joined: Wed Dec 10, 2008 3:26 pm

Re: big issue in web client

Postby rgansevles » Tue May 17, 2011 1:56 pm

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
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: big issue in web client

Postby domnulnopcea » Tue May 17, 2011 2:23 pm

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)
domnulnopcea
 
Posts: 42
Joined: Wed Dec 10, 2008 3:26 pm

Re: big issue in web client

Postby jcompagner » Tue May 17, 2011 5:09 pm

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...
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8833
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Web Development

Who is online

Users browsing this forum: No registered users and 3 guests