question

Sebastien avatar image
0 Likes"
Sebastien asked Sebastien commented

Calculated table not updating

Hello !

I have a source giving random product type. In order to know how many product of what type I got in the sink, I used the entry trigger to update a global table. As I do not know how many different products I will have I added an insert column in the entry trigger of the sink in case the product has never been seen before.

But then my calculated table showing the results from the global table is not updating at all. It just keeps displaying the columns in the first state of the simulation, not the columns that were added during it. The "always" or "interval" updates do not work for this purpose.

Is there a way to update the calculated table with the column added in the global table during the simulation ?

I created a dummy example attached below:

EDIT:

I tried the solution from @Roi Sánchez but I do not know what i'm doing wrong. Could somebody help me ? I attached the updated model below.

Moreover how can we also update the dashboard linked with the calculated table to always take new columns into account ?

test-dynamic-calculated-table-v2.fsm

Best regards,

test-dynamic-calculated-tabble.fsm

FlexSim 19.0.0
sqlcalculated table
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Roi Sánchez avatar image
3 Likes"
Roi Sánchez answered Sebastien commented

Hi @Sebastian, what I normally do is to set the update mode of the calculated table as "Manual" and then use the next code:

  1. Object ct = Model.find("Tools/CalculatedTables/Output");
  2. function_s(ct, "update", 1);

You can update the table each time an item gets processed.

· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Roi Sánchez avatar image
0 Likes"
Roi Sánchez answered Sebastien commented

Hi @Sebastian, maybe the reason why your calculated table only gets updated once is because you have to use this code every time you want it to be updated. For example if your calculated table should change every time an item gets processed, you would have to use this code in the 'OnProcessFinish' trigger.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.