question

Michal Klodawski avatar image
0 Likes"
Michal Klodawski asked Michal Klodawski commented

Assign string array to token label

Hi,

Is there way to assign string array to token label? I have:

stringarray TabID= makearray(10);
intarray TabIle= makearray(10);

//here I filled array with string and integer values
//and now I try to assign arrays to labels

setlabel(token,"CoUzupelnic",TabID); // is error

setlabel(token,"IleUzupelnic",TabIle); // is ok

thanks in advance for advices
Choose One
string
5 |100000

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

Matt Long avatar image
1 Like"
Matt Long answered Michal Klodawski commented

My guess is that you're not filling every element of the string array with data. If I designate a token as so() and execute the following code in a script window it works just fine:

stringarray TabID= makearray(10);

TabID[1] = "A";
TabID[2] = "B";
TabID[3] = "C";
TabID[4] = "D";
TabID[5] = "E";
TabID[6] = "F";
TabID[7] = "G";
TabID[8] = "H";
TabID[9] = "I";
TabID[10] = "J";

setlabel(so(),"CoUzupelnic",TabID);

If however, one of those lines were to be removed, the value would not be visible in the quick properties. This appears to be a bug in 2016 Update 2 where it won't display if the values are not valid.

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

Michal Klodawski avatar image Michal Klodawski commented ·

thanks, that's true, it was such situation that not always all elements of array had string data. thank you for reply :)

Michał

0 Likes 0 ·
Logan Gold avatar image
1 Like"
Logan Gold answered Michal Klodawski commented

The error is pointing to part of the code that is executed when the Quick Properties window tries to display a table view, which I believe is the Labels section in this case. I think it is a bug with how the Quick Properties window tries to display a string array in that Labels section when one or more of the array's slots in the string array are not initialized. I can't tell you for sure unless you include the code you used to fill the array for TabID or include the model so we can open it and take a look.

However, I was able to use your code and fill in all 10 values of the TabID array with a random strings and the Quick Properties window displays all strings in the token's CoUzupelnic label. But if I only fill in the first 9 values and don't put anything in the 10 slot, Quick Properties will not display the Labels field of the token correctly and I sometimes get the same error you have posted in the comments.

I also tested this in FlexSim 2017 and did not get the same error. Instead, the array slots that I did not fill in would show up as NULL in the Quick Properties window, which I believe is what is supposed to happen.

It's also possible that the Quick Properties window doesn't know how to display a symbol in one or more of the strings if there are any unusual characters in your strings. Again, I can't be sure until I was able to look at the code you are using to fill the arrays.

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

Michal Klodawski avatar image Michal Klodawski commented ·

thank you for reply, indeed the problem was in array with some null values,

0 Likes 0 ·
Sam Stubbs avatar image
0 Likes"
Sam Stubbs answered Logan Gold commented

I'm not sure which version you are using, that will make a difference. For example, in the most recent version of FlexSim (2017) the "intarray" and "stringarray" types are no longer used as such. Instead there is just an Array object type, that can be filled with other object type values (including other Array types).

But either way, you should be able to make any label on a token an array of values using the Assign Labels activity: (IN the value field under the picklist option Array > you will find all of the options for different ways to assign array values to your label.)


stringarray.png (13.1 KiB)
· 5
5 |100000

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

Michal Klodawski avatar image Michal Klodawski commented ·

Hi, thanks for reply, I have FLexSim 2016 update 2. Array type is not available yet. I've tried to create new label with array of string as you said but I have still the same exception as earlier. It is appearing when I click on token to see its labels after assigning string array to label:

exception: Exception caught in TreeNode::callMemberFunction() c++/dll execution. Throwing... VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties/TableView>eventfunctions/setFocus c: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties/TableView thisClass: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties/TableView
exception: Exception caught in flexscript execution of VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties>eventfunctions/onSelObjChange line 7 instruction 22. Discontinuing execution.
exception: Exception caught in TreeNode::callMemberFunction() flexscript execution VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties>eventfunctions/onSelObjChange c: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties theclass: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties
exception: treewin__OnPaint
ex: OnPaint
exception: Exception caught in TreeNode::callMemberFunction() c++/dll execution. Throwing... VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties/TableView>eventfunctions/setFocus c: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties/TableView thisClass: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties/TableView
exception: Exception caught in flexscript execution of VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties>eventfunctions/onSelObjChange line 7 instruction 22. Discontinuing execution.
exception: Exception caught in TreeNode::callMemberFunction() flexscript execution VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties>eventfunctions/onSelObjChange c: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties theclass: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties
exception: treewin__OnPaint
ex: OnPaint
exception: treewin__OnPaint
ex: OnPaint
exception: treewin__OnPaint
ex: OnPaint
exception: treewin__OnPaint
ex: OnPaint
exception: treewin__OnPaint
ex: OnPaint
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: size_t treewin__OnMouseMoveXX(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, TreeWin * t, int mx, int my)
ex: t->mousemove(hWnd,mx,my);exception: treewin__OnMouseMove
ex: OnMouseMove
exception: treewin__OnLeftDoubleClick
ex: OnLeftDoubleClick
exception: treewin__OnLeftDoubleClick
ex: OnLeftDoubleClick
exception: Exception caught in TreeNode::callMemberFunction() c++/dll execution. Throwing... VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties/TableView>eventfunctions/setFocus c: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties/TableView thisClass: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties/TableView
exception: Exception caught in flexscript execution of VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties>eventfunctions/onSelObjChange line 7 instruction 22. Discontinuing execution.
exception: Exception caught in TreeNode::callMemberFunction() flexscript execution VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties>eventfunctions/onSelObjChange c: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties theclass: VIEW:/active/MainPanel/BackPanel/SplitterXPane/SplitterYPane~2/ToolTabPane/TabControl/QuickProperties/ToolPanel/TokenProperties/Token Properties
exception: treewin__OnPaint
ex: OnPaint
0 Likes 0 ·
Sam Stubbs avatar image Sam Stubbs ♦ Michal Klodawski commented ·

This error is unrelated to your array. If you save and quit and reopen the file, this error message should stop firing.

0 Likes 0 ·
Michal Klodawski avatar image Michal Klodawski commented ·

It didn't help :( On string still doesn't work, I will try to do this on int because with integers it works.

Thanks for reply

0 Likes 0 ·
Sam Stubbs avatar image Sam Stubbs ♦ Michal Klodawski commented ·

If you can, I'd assign the string values of the array using an Assign Labels activity, rather than just initiating it via code.

0 Likes 0 ·
Michal Klodawski avatar image Michal Klodawski Sam Stubbs ♦ commented ·

I'm still trying with integers :) Besides I don't know how to pull array from code to Assign Labels activity

0 Likes 0 ·