question

Joerg Vogel avatar image
0 Likes"
Joerg Vogel asked Matt Long answered

Why is the result no data, when nothing is pulled in an activity?

If I pull something from a list in the Pull from List activity and the result is empty, the label contains No Data. I get the same result when I pull from a list and the result variable is declared as a Variant in the source code. When the variable is declared as an Array I get at least an empty Array. It is disturbing to see a red arrow in the labels group of the quick properties window. An empty array looks more friendly, because I wouldn't assume I made a mistake.

FlexSim 17.2.5
no datapull from list activitypull nothing
· 2
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 Matt Long commented ·

I'm not sure I understand. How are you getting the empty array? What do you mean by declaring the result variable as a Variant or as an Array?

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Matt Long commented ·

@Matt Long, if I use the pull from list activity, the pulled data is stored to a Variant label, as you can see this in the attached model and the picture.

pull-from-list-no-data.fsm

If I pull from the list by source code, I am able to choose the datatype the pulled data is stored into. Then I can put the data into an array and the data information is in the quick properties on the token label named pulled: Array[0].

In the following code I do the same as the pull from list activity in the model besides I store the data as an array. See the model pull-from-list-array0.fsm

Object current = param(1);
treenode activity = param(2);
Token token = param(3);
treenode processFlow = ownerobject(activity);
List localList = List("ItemList1");
int partition = token.randomID;
Array pulled = localList.pull("WHERE place = 3",100,0,nullvar,partition,0);
Array empty = [];
token.labels.assert("emptyArray",empty);
token.labels.assert("nullvarArray",[nullvar]);
token.labels.assert("empty",nullvar);
token.labels.assert("pulled",pulled);
// Variable as an array, I get readable data.
// Variable as Variant I get No Data

The difference is that at the end I assign different labels data to be visible on the token labels to compare them. It is the code that leads to the picture of my question.

0 Likes 0 ·

1 Answer

·
Matt Long avatar image
0 Likes"
Matt Long answered

When you say:

Array pulled = list.pull();

you are casting whatever value is returned from the pull() method into an Array. This will always cause the data to be an array with 0 or more elements. The Pull From List activity gives you back exactly what was pulled. So if nothing was pulled then it returns null, or no data.

If you want to display the pulled data as an array, you'll need to do the same thing your code is doing. Cast the value of the pulled data into an array.

5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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