Hello,
I tried to build the following scenario:
A global table, Table1 has columns 1,2,3 in one part of process flow model. In another part, the token checks to see if the label it carries matches any value on the Table1 col 1. If a value exists in col 1, ie., condition true then update the col 3 of that row and if condition false, it has to add a new row and add values on token to col 1 and col 3. ( All labels exist and have no erros)
I used the following code but I keep getting an error:
if(Table("Table1").getValueByKey(token.Day,1) == token.Day)
{
int x = Table("Table1").getRowByKey(token.Day,1);
Table("Table1")[x][3] = Table("Table1")[x][3] + token.y;
}
else {
double rows = Table("Table1").numRows+ 1;
addtablerow(Table("Table1"),rows);
Table("Table1")[Table("Table1")[1] = token.Day;
Table("Table1")[Table("Table1")[3] = token.y;
}
Error : time: 164.000000 exception : FlexScript exception: no row found for key 164 in col NULL at MODEL/Tools/ProcessFlow/ProcessFlow/Record Order Received > variables/codeNode
I tried splitting the custom code using decide function to navigate to true and false conditions. Either ways, the it works as long as condition is true. If the condition is false it throws an error. I dont understand where it is going wrong.