Hello,
If I understand correctly, you need to pass the column of the table as a parameter with four possible values, right? This will allow you to add the parameters to the optimizer.
To do that, the only way I see is to create a parameter for each row.
I created a code to try to automate this process, but you will need to create the first parameter manually.
The name of the parameter doesn’t matter, but for its value, we need to set the type as "Option." Then, create four options and add the corresponding name to each one (just to visualize them in the parameters). Next, set the reference to the first row, second column of the table.
In the onSet code, insert something like this:
Array names = ["ICC","IXD","FC","PLP"];
reference.value = names[newValue];
Once this parameter is set up correctly, you can copy it across the entire table by executing a script like this:
treenode parameters = Model.find("Tools/ParameterTables/Parameters>variables/parameters");
string TableName = "GlobalTable1";
Table table = Table(TableName);
int num = 0;
int j = 2;//Column
treenode Copied;
for (int i = 1; i <= table.numRows; i++){
num += 1;
if(parameters.subnodes.length < num){
treenode toCopy = parameters.last;
nodeinsertafter(toCopy);
Copied = createcopy(toCopy,toCopy.next,0,0,0,1);
}
else{
Copied = parameters.subnodes[num];
}
Copied.find("/Name").value = TableName + "[" + i + "][" + j + "]";
Copied.find("/Value/reference").value = table.as(treenode).subnodes[i].subnodes[j];
}
This will create one parameter for each row, copying all the information but changing the name and the reference.
Thank you!