<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dot syntax failing with tracked-variable labels in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13606233#M95831</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15959811"&gt;@guiroehe&lt;/a&gt;&amp;nbsp;Those two examples you referenced are not "incorrect syntax", they both work. For example,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;reference.as(TrackedVariable).maximum&lt;/PRE&gt;
&lt;P&gt;This works because reference returns a node and the node can be cast as a TrackedVariable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's different about your situation is that you're using the dynamic label property "statsItemLifetime". This doesn't return a node. It returns the value of the "statsItemLifetime" label node. To get the actual node of the label node you have to use the&amp;nbsp;&lt;EM&gt;object.labels["labelName"]&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;syntax.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Apr 2025 18:28:14 GMT</pubDate>
    <dc:creator>Matthew_Gillespie</dc:creator>
    <dc:date>2025-04-29T18:28:14Z</dc:date>
    <item>
      <title>Dot syntax failing with tracked-variable labels</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13600653#M94486</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 25.1.1 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;Hello,&lt;/P&gt;
 &lt;P&gt;from examples and answers from the forum (e.g. &lt;A rel="nofollow" href="https://answers.flexsim.com/questions/80701/graph-multiple-data-of-a-tracked-variable-in-one-c.html,"&gt;https://answers.flexsim.com/questions/80701/graph-multiple-data-of-a-tracked-variable-in-one-c.html,&lt;/A&gt; &lt;A rel="nofollow" href="https://answers.flexsim.com/questions/177837/performance-measure-from-tracked-variable.html​"&gt;https://answers.flexsim.com/questions/177837/performance-measure-from-tracked-variable.html&lt;/A&gt;) the following syntax should work to update tracked-variable labels:&lt;/P&gt;
 &lt;PRE&gt;myObject.myLabel = newValue;&lt;/PRE&gt;
 &lt;P&gt;or&lt;/P&gt;
 &lt;PRE&gt;myObject.myLabel.as(TrackedVariable).value = newValue;&lt;/PRE&gt;
 &lt;P&gt;However, as one can see below, the only working syntax is using the "labels" format:&lt;/P&gt;
 &lt;PRE&gt;myObject.labels["myLabel"].as(TrackedVariable).value = newValue;&lt;/PRE&gt;
 &lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1745479772533.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1527321i2D531884E425E009/image-size/large?v=v2&amp;amp;px=999" role="button" title="1745479772533.png" alt="1745479772533.png" /&gt;&lt;/span&gt;&lt;/P&gt;
 &lt;P&gt;It also fails when reading the variable content:&lt;/P&gt;
 &lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1745479995726.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1527323i7AED8617F3DD9217/image-size/large?v=v2&amp;amp;px=999" role="button" title="1745479995726.png" alt="1745479995726.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 24 Apr 2025 07:33:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13600653#M94486</guid>
      <dc:creator>guiroehe</dc:creator>
      <dc:date>2025-04-24T07:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dot syntax failing with tracked-variable labels</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13600654#M94487</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Both examples you linked use Tracked Variables from the toolbox and the references point to the node in both cases, making it possible to cast the reference as TR and read the property.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1745484873257.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1527316iD3515ECC9B8B6313/image-size/large?v=v2&amp;amp;px=999" role="button" title="1745484873257.png" alt="1745484873257.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1745484906368.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1527317iA7CC3DE525BBF48C/image-size/large?v=v2&amp;amp;px=999" role="button" title="1745484906368.png" alt="1745484906368.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Using &lt;EM&gt;object.labelName&lt;/EM&gt; gets the value of the TR-node, a number, which can not be cast as a TR. You do in fact have to use the &lt;EM&gt;object.labels["labelName"]&lt;/EM&gt; syntax to get the TR/Label-node and access properties of the TR.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 24 Apr 2025 08:59:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13600654#M94487</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2025-04-24T08:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dot syntax failing with tracked-variable labels</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13600655#M94488</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;Hi, &lt;A rel="user" href="https://answers.flexsim.com/users/19365/felixmh.html" nodeid="19365"&gt;@Felix Möhlmann&lt;/A&gt; , thank you.&lt;/P&gt;
 &lt;P&gt;You are correct on your interpretation. My observation is about the incorrect syntax used in the previous answers from FlexSim. I could not find any explicit reference about this in the help files.&lt;/P&gt;
 &lt;P&gt;Thank you for the confirmation.&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 25 Apr 2025 16:33:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13600655#M94488</guid>
      <dc:creator>guiroehe</dc:creator>
      <dc:date>2025-04-25T16:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dot syntax failing with tracked-variable labels</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13606233#M95831</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15959811"&gt;@guiroehe&lt;/a&gt;&amp;nbsp;Those two examples you referenced are not "incorrect syntax", they both work. For example,&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;reference.as(TrackedVariable).maximum&lt;/PRE&gt;
&lt;P&gt;This works because reference returns a node and the node can be cast as a TrackedVariable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's different about your situation is that you're using the dynamic label property "statsItemLifetime". This doesn't return a node. It returns the value of the "statsItemLifetime" label node. To get the actual node of the label node you have to use the&amp;nbsp;&lt;EM&gt;object.labels["labelName"]&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;syntax.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Apr 2025 18:28:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13606233#M95831</guid>
      <dc:creator>Matthew_Gillespie</dc:creator>
      <dc:date>2025-04-29T18:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Dot syntax failing with tracked-variable labels</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13607777#M95845</link>
      <description>&lt;P&gt;Hello, &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/17307556"&gt;@Matthew_Gillespie&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;I understand, despite the very confusing and sparse documentation and attempts to make sense of this.&lt;/P&gt;&lt;P&gt;As a suggestion, FlexSim should get fix this "auto-return value" for labels to a proper object-oriented architecture:&lt;/P&gt;&lt;P&gt;just return whatever object the label is.&lt;/P&gt;&lt;P&gt;Currently:&lt;BR /&gt;- it does not work well if a label is anything but a number or a string&lt;/P&gt;&lt;P&gt;- it causes problems when one stores macros on labels&lt;/P&gt;&lt;P&gt;- is causes problem when a label is an object of any type&lt;/P&gt;&lt;P&gt;My suggestion would also eliminate the need of extensively annoying casting, which is actually a counter example of C foundation (or any other decent OO language coming from C).&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 14:36:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13607777#M95845</guid>
      <dc:creator>guiroehe</dc:creator>
      <dc:date>2025-04-30T14:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dot syntax failing with tracked-variable labels</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13607906#M95847</link>
      <description>&lt;P&gt;Labels are working as designed. They do a great job doing their primary purpose which is quickly storing and retrieving little bits of data on an object. We will not be "fixing" this "auto-return value" because that would totally destroy their purpose.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"it does not work well if a label is anything but a number or a string"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Labels work great for setting and retrieving numbers, strings, and direct pointers to objects. It's also very easy to automatically evaluate FlexScript labels. These are the main things that your average user uses labels for. That's why we provide this quick and easy way to get and set simple values on labels.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you are doing something more complicated with your labels you need to use the labels["labelName"] syntax to make sure you get the actual label node.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The documentation is pretty clear on how to use labels, in my opinion.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.flexsim.com/en/25.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Tree/treenode.html#Property-labelProperties" target="_blank" rel="noopener"&gt;FlexScript labelProperties&amp;nbsp;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.flexsim.com/en/25.0/Reference/CodingInFlexSim/FlexScriptAPIReference/Tree/treenode.html#Property-labels" target="_blank" rel="noopener"&gt;FlexScript labels&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Feel free to create a separate suggestion post with any ideas you have for how this could work better for you and see if other users agree.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2025 15:44:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13607906#M95847</guid>
      <dc:creator>Matthew_Gillespie</dc:creator>
      <dc:date>2025-04-30T15:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dot syntax failing with tracked-variable labels</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13622236#M96035</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/17307556"&gt;@Matthew_Gillespie&lt;/a&gt;,&lt;BR /&gt;I understand your point, despite my personal opinion is different.&lt;BR /&gt;Considering FlexSim is trying to move to a ".dot syntax" and labels seem to have a huge part on it (e.g. labels storing flexscript as a surrogate to object methods), ambiguities arise when one has to decide between using object.label (= object.labels["label"].value) and object.labels["label"].evaluate(), for instance. The same applies for labels storing macros or other "more complicated" (?!) things.&lt;BR /&gt;Instead, if a label always returns its node, one can easily decide between adding ".value", ".evaluate()", doing a cast or any other method to the node. This would make overall code writing simpler, potentially eliminating the need for the ".labels[label]" syntax.&lt;/P&gt;&lt;P&gt;As I said, its my opinion. My intention was not to antagonize you, just highlight how this can be confusing to "your average user". Regarding the documentation links:&lt;/P&gt;&lt;P&gt;- a reference about how labels work as tracked variables is missing there&lt;/P&gt;&lt;P&gt;And on the tracked-variables:&lt;/P&gt;&lt;P&gt;- a reference about how tracked variables need to be updated depending on their type (cummulative, level, time-series, ...) would be appreciated, as they will often be used as labels, despite this is a different subject.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2025 17:51:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/dot-syntax-failing-with-tracked-variable-labels/m-p/13622236#M96035</guid>
      <dc:creator>guiroehe</dc:creator>
      <dc:date>2025-05-09T17:51:10Z</dc:date>
    </item>
  </channel>
</rss>

