Idea

Arun Kr avatar image
2 Likes"
Arun Kr suggested Rob Davies commented

Search In Global Table

It will be really helpful if we have search functionality in the global table, like in excel sheet.

Suppose I want to search for a particular cell value/ string in the global table, which is having a large number of rows and columns. It is a tedious and time-consuming task.

If this technique already exists in FlexSim for global table, please help.

Regards,

Arun KR

global table
5 |100000

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

Matthew Gillespie avatar image
2 Likes"
Matthew Gillespie commented Joerg Vogel edited

A script to look through each cell of the table is pretty easy to write:

Variant searchVal = "blah";
Table table = reftable("myTable");

for(int i = 1; i <= table.numRows; i++) {
	for(int j = 1; j <= table.numCols; j++) {
		if(table[i][j] == searchVal)
			return [i, j];
	}
}
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

could you use the query command to get the same result with a bit less script?

1 Like 1 ·
Steven Hamoen avatar image
1 Like"
Steven Hamoen commented

And what about using a query:

query( "SELECT Col1 FROM Data WHERE Col2 = 'A' " );
int result = getqueryvalue(1,1);
· 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.

Rob Davies avatar image Rob Davies commented ·

@steven.hamoen Can you explain how this fits into a decision to choose next activity. I have a similar need and am trying to use this statement to get a value.

query("SELECT HCPType FROM TreatmentFormulary WHERE TXID = 3");

TXID = 3 will come from a label on the patient. I'm used to doing this in VBA. Still getting used to Flexsim.

0 Likes 0 ·

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.