TACTIC Open Source
Expression wdg cache issue - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Expression wdg cache issue (/showthread.php?tid=99)



Expression wdg cache issue - EricTsuei - 04-23-2020

how to enable expression wdg's cache function in a proper way?
when I  just turn the "use cache" to true, I can't get any results. 
if I am not using cache, and can't filter or sort this column.


RE: Expression wdg cache issue - remkonoteboom - 04-23-2020

Looking at the code, use_cache assumes that the sobject has pre-calculated the column somewhere else, however I don't actually see the point of this. If this value was calculated earlier, then a simple default column would work fine.

So, in another column, say in Python, say we calculated a total value

...
total_value = 0
for value in values:
total_value += value
sobject.set_value("total_value", total_value)

And then, since the later column uses the same sobject, you can just do:

@GET(.total_value)

And it will get this temporary cached value. Note that "total_value" doesn't exist in the database so it should not be commited.


RE: Expression wdg cache issue - EricTsuei - 04-24-2020

so, what if I create a column name all_task_cost, and set it as expression wdg.
then the expression is @SUM(sthpw/task.bid_cost) , so this column sum all tasks of this asset's bid_cost. and works fine.
so how can I order with this "all_task_cost" column
I found there is a use cache switch that can be turned on, so the "Order by" function can use.
but after turn on this use cache, the column give me empty values, not works anymore.