Page 1 of 1

Calculations referencing form methods

PostPosted: Fri May 16, 2014 4:23 pm
by rossent
Hi Servoy,

In some calculations we have references to form methods (leftover from the time when there were no scopes and only "globals". These "forms" are really used as "containers" to separate the code into different files instead of having enormous globals.js)

Now we discover in the server logs errors similar to:

Exception executing calculation: calcf_price of table im_sku, error: org.mozilla.javascript.EcmaError: TypeError: Cannot find function getRecForSpecificDate in object <Form biz__argos_user_data__im_price_code_date not loaded yet>


It appears that when calculations are evaluated, any forms referenced as: "forms.some_form_name...." are not being loaded (using "scopes.some_scope_name..." however works fine)

Looking at the available documentation in the Servoy Wiki about calculations I cannot find any reference to restrictions on using form methods in calculations. Also, I have not seen these errors before (we use Servoy 7.4)

My question is: Can form methods be used in calculations or not? If yes, why do we get the errors above "...<Form some_form_name not loaded yet>..."? If no, why there is no "warning" about this in the documentation similar for example to the warning about the performance? (see: https://wiki.servoy.com/display/public/ ... lculations)

Re: Calculations referencing form methods

PostPosted: Mon May 19, 2014 2:55 pm
by rossent
We are trying to figure out if we need to change our code OR if we need to create a bug case. Any input will be most welcome.

Re: Calculations referencing form methods

PostPosted: Mon May 19, 2014 4:12 pm
by Harjo
As far as I know, from the beginning of Servoy it was never recommended to use form stuff, in calculations, so we always avoided it.

Here is an (very-old) topic, in which Johan explains: viewtopic.php?f=3&t=2768&hilit=calculation+touch+form