question

Mischa Spelt avatar image
0 Likes"
Mischa Spelt asked Mischa Spelt commented

Specify displayText for bundle

Hi,

When using a table view (viewwindowtype 5), how can I provide a custom display text for a column?

It seems that the displayText node expects a treenode for param(1), which works fine for node-based tables, but of course for a bundle there is no cell node.

Please see the attached model, where I gave both global tables a custom GUI. For the node-based Global Table it works (I see the custom display text "value + [Click Me!]", but for the bundle-based table it doesn't as cellNode is null.

CustomGUI_viewwindowtype5.fsm


1656350778851.png

FlexSim 22.0.4
custom guibundle data
· 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.

Mischa Spelt avatar image Mischa Spelt commented ·
@anthony.johnson or @Jordan Johnson any bright ideas perhaps? :-)
0 Likes 0 ·
anthony.johnson avatar image
2 Likes"
anthony.johnson answered Mischa Spelt commented

The engine code for resolving custom display text is:

if (format->displayText) {
   Variant temp = format->displayText->evaluate(cellNode, row, col, precision);
   if (temp.type == VariantType::String) {
      customStr = temp;
      str = (char*)customStr.c_str();
   }
}

It looks like the row and column numbers are passed in as param(2) and param(3), so you should be able to use those to determine display text for bundle table views.

· 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.

anthony.johnson avatar image anthony.johnson ♦♦ commented ·
For the next release I'm going to add a 5th parameter that is the root table node, so with bundle tables you don't have to dereference it every time through c.find("~>viewfocus+").
2 Likes 2 ·
Mischa Spelt avatar image Mischa Spelt commented ·

Cool, thanks! For now, I went with

treenode cellNode = param(1);
int row = param(2);
int col = param(3);
int precision = param(4);

Variant value;
if(cellNode)
{
  value = cellNode.value;
}
else
{
  Table table = c.find("~>viewfocus+");
  value = table[row][col];
}

return "Value: " + string.fromNum(value, precision);


0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered

Finally I got it working:

customgui-viewwindowtype5-JV_bruteForce.fsm

It is based on the answer of @anthony.johnson

https://answers.flexsim.com/questions/22094/how-to-access-node-array-values.html

if you parse the name on table into a table declaration you can get access to values of a bundle even if you haven't got a cell node.

It is obviously not what you are looking for, because it will cost a lot of system time to build for each cell a new table of all values.

fill-table-cell-windowtype5-bundledata.jpg


5 |100000

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