question

Arun Kr avatar image
0 Likes"
Arun Kr asked Joerg Vogel edited

Changing Field Value of List Entry

Hi,

Is it possible to change the field value of a list entry?

Suppose I have a list entry with a constant field value. How can I change that field value using code?

Regards,

Arun KR

FlexSim 17.0.0
lists
list.png (22.0 KiB)
· 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.

Mischa Spelt avatar image Mischa Spelt commented ·

There are definitely solutions to the problem as asked, but they are either code-intensive and probably hacky (setsdtvalue) or slow (make the field dynamic). If you could be a bit more specific about the _actual_ problem you are trying to solve we can maybe suggest an alternative solution.

2 Likes 2 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Mischa Spelt commented ·

Unfortunately, you cannot use setsdtvalue() in this case. The engine doesn't support it.

1 Like 1 ·

1 Answer

·
Jordan Johnson avatar image
3 Likes"
Jordan Johnson answered Joerg Vogel edited

I recommend a dynamic label field. Each time that value is needed during a query, there is a call to the getlabel() command, which is not a slow command, although it is true that a static field lookup is faster. Most improvements in speed in a model come from changing algorithms and removing sorts.

Another option would be to remove the entry from the list and re-add it, with the new value. Since that changes the order of entries on the list, that might ruin your logic. But if you have an ORDER BY statement when you pull from the list, it's possible that such a change would be fine.

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

A variant of the another option would be to push the same push value with changed labels to the same list. The static fields are updated and the order isn't changed. The Option Unique Values Only must be active under the General tab of the list properties (Flexsim 17.2.5).

0 Likes 0 ·

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.