TIP: don't use custom queries in calculations.

First those are very bad for performance, because when ever that calc is triggered that query is done, this would really hurt if you would be a in tableview where 1 column is that calculation.

Besides that, now in a few releases of servoy we have a real calculation dependency tracking. This works this way that we know what the calculation did touch to be able to get to its value.
Then if any of those values change the calc is flagged to be recalculated.

Now if you do this in a calculation:

databaseManager.getDatasetByQuery(“select nicething from anothertable where x = ?”,[dataprovider_of_same_record]);

so you go to a different table where you select something based on something of this record.

Then don’t expect the calculation to be recalculated if something of that anothertable changes, if that “dataprovider_of_same_record” would be the pk column. then this calculation would never be recalculated as long its in memory for that client
Because the pk would never change.

Always use relations for this so the above code should be:

relation_to_anothertable.nicething

now we know you touched that relation and that nicething from that other table, so if now anything in between (primary dataproviders or related dataproviders) that changes we will flag the calculation and it will be recalculated.

The big side effect is also that we do cache that relation so when that is reused it could be that there are also no queries being done to the server.

I like Johan’s ‘tip-mode’ :D

mboegem:
I like Johan’s ‘tip-mode’ :D

For sure!

Nice tip will get used to it. :)

Thanks
Chaitanya s

we want more!! :D

would love some tips about how to best use entity scopes…

swingman:
would love some tips about how to best use entity scopes…

This? https://www.servoy.com/forum/viewtopic.php?f=22&t=19420

no those are not entity scopes but normal named global scopes (so the same as globals.js but then named under a different name and there can be only 1 name throughout the complete solutions and its modules)

entity scopes are the foundset scopes to give a foundset extra functionality
Those just should be used if you have business rules that is based on that table/data, really belong to that datasource, so its just a narrower scope then what a named global scope would be.

Very nice these Tips !

Hans

Thank you! :-)

mboegem:
I like Johan’s ‘tip-mode’ :D

  • 1 … You are funny lol