question

Raul Vazquez avatar image
0 Likes"
Raul Vazquez asked Enrique Elizaga commented

Check if row in table does not exists for custom code

Hi team,

Im creating a logic to find values using a row name like below:


  1. Table("WO_ConfigTable")["Dummy_"+something]["Line"]

where "something" can change due is string variable in my model , but there are cases where i dont have the proper row header name and that is ok but this issue appear below when i have a not valid row header:

  1. exception: FlexScript exception: Dummy_Generic is not a valid row name for Global Table "WO_ConfigTable" at <no path> c: <no path> i: <no path>

Could you please let me know what i can use in order to return "0" for the null values? in order to dont have issues in the system console.

I tried using "if(Table("WO_ConfigTable")["Dummy_"+something]["Line"]==NULL)" but not work


Thx a lot

FlexSim 20.1.3
flexsim 20.1.3nullrowheaderno path
5 |100000

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

1 Answer

Phil BoBo avatar image
2 Likes"
Phil BoBo answered Enrique Elizaga commented

If your table is a treenode table, you can access its subnodes to see whether the row exists:

  1. Table myTable = Table("GlobalTable1");
  2. string rowName = "Dummy_Generic";
  3. string colName = "Line";
  4. treenode tableNode = myTable;
  5. if (!tableNode.subnodes[rowName])
  6.     return 0;
  7. return myTable[rowName][colName];


1594675733040.png (37.1 KiB)
· 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.