Copy Paste Excel Data as Pointer Data in Global Table

Copy Paste Excel Data as Pointer Data in Global Table

kshitijdhake
Contributor Contributor
101 Views
3 Replies
Message 1 of 4

Copy Paste Excel Data as Pointer Data in Global Table

kshitijdhake
Contributor
Contributor

I have around 300 rows in my global table which represent distinct parts. I want to assign Queue location to each part. I have 300 different Queue location 

When I copy paste the data global table considers it as a string. How to copy paste a pointer data ? 

0 Likes
102 Views
3 Replies
Replies (3)
Message 2 of 4

FelixMoehlmann
Collaborator
Collaborator

You can't directly paste data as pointers. A pointer only exists in the context of the FlexSim model and can't be imported from another program. But you can use a simple for-loop to convert the string to a pointer by searching for the object by name. This could be done as part of the Post Import Code if you are using the Excel Import/Export tool, in the reset trigger of the global table or in the script console.

Table table = Table("GlobalTable1");
int nameColumn = 1;
int pointerColumn = 2;
for(int row = 1; row <= table.numRows; row++)
{
	table[row][pointerColumn] = Model.find("?" + table[row][nameColumn]);
}

If all the objects are direct subnodes of the model you don't need the "?" in Model.find(). It makes the search recursive, also checking subnodes/subfolders for nodes with the name. But it is a lot slower which might make a difference if the table or model is very large. As you can see I don't overwrite the name data, which might help to spot errors and fix them manually.

0 Likes
Message 3 of 4

kshitijdhake
Contributor
Contributor

Should I just copy paste this code in the post import code? 

I have 3 different columns which need to be converted to pointer 

I am copy pasting the data in the following way

For example : Queue name is "xyz"

Col1 has "/xyz"

0 Likes
Message 4 of 4

FelixMoehlmann
Collaborator
Collaborator

Using it in the Post Import Code is one option, yes. Of course you need to change the table name and column numbers to match your table. With the "/" included do not put the "?" in front. Only do "Model.find(table[row][nameColumn])".

0 Likes