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.