<?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: Get Variable Shared Asset Value in Code in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561640#M63964</link>
    <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;You're right. I only tested it when the variable was set to reference an object's stats, sorry for that.&lt;/P&gt;&lt;P&gt;Try this instead:&lt;/P&gt;&lt;PRE&gt;Variant value = getsdtvalue(processFlow.find("MyVar&amp;gt;stats/instances/ProcessFlow"), "currentValue");&lt;/PRE&gt;&lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/43484-variable-in-code.fsm" target="_blank"&gt;Variable_In_Code.fsm&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 02 Sep 2021 16:53:09 GMT</pubDate>
    <dc:creator>moehlmann_fe</dc:creator>
    <dc:date>2021-09-02T16:53:09Z</dc:date>
    <item>
      <title>Get Variable Shared Asset Value in Code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561637#M63961</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 21.1.5 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;DIV class="fr-view clearfix"&gt;
  &lt;P&gt;For a Process Flow Variable, I can get its value using &lt;EM&gt;getprocessflowvar(processFlow, "pfVar")&lt;/EM&gt;&lt;/P&gt;
  &lt;P&gt;But I'm struggling with getting a Variable shared asset's current value using flexscript.&lt;/P&gt;
  &lt;P&gt;Some of what I've tried...&lt;/P&gt;
  &lt;P&gt;&lt;EM&gt;getvarnum(processF&lt;/EM&gt;&lt;EM&gt;low, "MyVar"&lt;/EM&gt;)&lt;/P&gt;
  &lt;P&gt;&lt;EM&gt;Model.find("MyVar").value&lt;/EM&gt;&lt;/P&gt;
  &lt;P&gt;&lt;EM&gt;getstat(getactivity(processFlow, "MyVar"), "Content", STAT_CURRENT)&lt;/EM&gt;&lt;/P&gt;
  &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
  &lt;P&gt;Any help would be appreciated. Thanks&lt;/P&gt;
 &lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Sep 2021 14:29:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561637#M63961</guid>
      <dc:creator>stan_e_davis</dc:creator>
      <dc:date>2021-09-02T14:29:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get Variable Shared Asset Value in Code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561638#M63962</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;PRE&gt;Variant value = processFlow.find("MyVar&amp;gt;variables/variableRef").evaluate();&lt;/PRE&gt;&lt;P&gt;I don't know if this is the "proper" way to access it (probably not), but it should work.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Sep 2021 14:55:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561638#M63962</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2021-09-02T14:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Get Variable Shared Asset Value in Code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561639#M63963</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Unfortunately that just returns the Variable's 'initial' value as set in the 'Variable or Value' property. It does not return the Variables current value.
&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Sep 2021 16:36:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561639#M63963</guid>
      <dc:creator>stan_e_davis</dc:creator>
      <dc:date>2021-09-02T16:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Get Variable Shared Asset Value in Code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561640#M63964</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;You're right. I only tested it when the variable was set to reference an object's stats, sorry for that.&lt;/P&gt;&lt;P&gt;Try this instead:&lt;/P&gt;&lt;PRE&gt;Variant value = getsdtvalue(processFlow.find("MyVar&amp;gt;stats/instances/ProcessFlow"), "currentValue");&lt;/PRE&gt;&lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/43484-variable-in-code.fsm" target="_blank"&gt;Variable_In_Code.fsm&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Sep 2021 16:53:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561640#M63964</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2021-09-02T16:53:09Z</dc:date>
    </item>
    <item>
      <title>Re: Get Variable Shared Asset Value in Code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561641#M63965</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;I appreciate the help. However, that's still not working for me. I'm also getting errors with your attached model...&lt;/P&gt;
 &lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1630603177410.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1507282i607D3646BA88FAE1/image-size/large?v=v2&amp;amp;px=999" role="button" title="1630603177410.png" alt="1630603177410.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Sep 2021 17:24:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561641#M63965</guid>
      <dc:creator>stan_e_davis</dc:creator>
      <dc:date>2021-09-02T17:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Get Variable Shared Asset Value in Code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561642#M63966</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Ok, so the "ProcessFlow" in the .find-command has to be replaced with the name of the processflow instance the variable is in. Apparently the name change only took effect when saving the model.&lt;/P&gt;&lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/43494-variable-in-code-2.fsm" target="_blank"&gt;Variable_In_Code_2.fsm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;This one should (hopefully, finally) work.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Sep 2021 17:33:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561642#M63966</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2021-09-02T17:33:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get Variable Shared Asset Value in Code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561643#M63967</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Felix, yep, that worked and understood. I appreciate the help with this. - Stan
&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Sep 2021 18:56:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561643#M63967</guid>
      <dc:creator>stan_e_davis</dc:creator>
      <dc:date>2021-09-02T18:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Get Variable Shared Asset Value in Code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561644#M63968</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hi &lt;A rel="user" href="https://answers.flexsim.com/users/626/stan.d.html" nodeid="626"&gt;@stan.davis&lt;/A&gt;, was Felix Möhlmann's answer helpful? If so, please click the red "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.&lt;/P&gt;&lt;P&gt;If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Sep 2021 19:24:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/get-variable-shared-asset-value-in-code/m-p/13561644#M63968</guid>
      <dc:creator>ryan_c10</dc:creator>
      <dc:date>2021-09-07T19:24:12Z</dc:date>
    </item>
  </channel>
</rss>

