question

Ankur A3 avatar image
0 Likes"
Ankur A3 asked Ankur A3 commented

Check for Dynamic Row Header?

Hi Team,

I have 2 global tables: 1. ProviderName 2. ProviderSlotDashboard

User may interact with "ProviderName" table and change the provider name anytime based on availability. In 2nd table "ProviderSlotDashboard", slots will be counted based schedule automatically using logic with respect to provider names.

Is there any way if I can make row header dynamic for 2nd table "ProviderSlotDashboard" based on my 1st global table "ProviderName"?

1653374126898.png

DynamicRowCheck.fsm

Please let me know if there is any other way to approach for the same.

Thank you!


FlexSim 21.0.10
global tabledynamicrowheader
1653374126898.png (3.4 KiB)
dynamicrowcheck.fsm (25.1 KiB)
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

·
Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Ankur A3 commented

You can use the reset trigger of the table to add code which sets the row headers to the values of the first column in the name table.

The code in the attached model also adds rows if there are fewer rows than in the naming table. Rows with no equivalent in the naming table will get an empty header.

/**Custom Code*/
Table current = param(1); //Table node

// Reference to other table
Table providers = Table("ProviderName");

// Go through tables (the longer one determines loop count)
for(int row = 1; row <= Math.max(current.numRows, providers.numRows); row++)
{
    // If current table doesn't have enough rows, add one
    if(current.numRows < row)
    {
        current.addRow();
    }
   
    // If providers table has row, set row header to first column value
    if(providers.numRows >= row)
    {
        current.setRowHeader(row, providers[row][1]);
    }
    // Otherwise use empty string
    else
    {
        current.setRowHeader(row, "");
    }
}

dynamicrowcheck_fm.fsm


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

Ankur A3 avatar image Ankur A3 commented ·

Thank you so much @Felix Möhlmann !

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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