<?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 Reset Label via FlexScript in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598334#M92581</link>
    <description>&lt;P&gt;&lt;I&gt;[ FlexSim 25.1.0 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;We are trying to assign labels of integer value to processors via FlexScript. See code below.&lt;BR /&gt;&lt;BR /&gt;We accidentally ran this code multiple times. Now, the type of the label is an array with multiple duplicate integers.&lt;BR /&gt;&lt;BR /&gt;We want to revert back to the original integer value we assigned. We also want these labels to be static. How should we go about this?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;See the original code:&lt;/P&gt;
 &lt;P id="isPasted"&gt;clearconsole;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;int numRows = Group("Sourcing Group").length;&lt;/P&gt;
 &lt;P&gt;Array myGroups = ["Sourcing Group", "Conditioning Group", "Finishing Group", "Packing Group", "Distribution Group"];&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;for (int i = 1; i &amp;lt;= myGroups.length; i++) {
  &lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;for(int j = 1; j &amp;lt;= numRows; j++){
   &lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;Object processor = Group(myGroups&lt;I&gt;);&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;processor.location = j;&lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;print(j);&lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;print(i);&lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;}&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Tue, 08 Apr 2025 21:59:13 GMT</pubDate>
    <dc:creator>a600</dc:creator>
    <dc:date>2025-04-08T21:59:13Z</dc:date>
    <item>
      <title>Reset Label via FlexScript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598334#M92581</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 25.1.0 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;We are trying to assign labels of integer value to processors via FlexScript. See code below.&lt;BR /&gt;&lt;BR /&gt;We accidentally ran this code multiple times. Now, the type of the label is an array with multiple duplicate integers.&lt;BR /&gt;&lt;BR /&gt;We want to revert back to the original integer value we assigned. We also want these labels to be static. How should we go about this?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;See the original code:&lt;/P&gt;
 &lt;P id="isPasted"&gt;clearconsole;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;int numRows = Group("Sourcing Group").length;&lt;/P&gt;
 &lt;P&gt;Array myGroups = ["Sourcing Group", "Conditioning Group", "Finishing Group", "Packing Group", "Distribution Group"];&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;for (int i = 1; i &amp;lt;= myGroups.length; i++) {
  &lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;for(int j = 1; j &amp;lt;= numRows; j++){
   &lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;Object processor = Group(myGroups&lt;I&gt;);&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;processor.location = j;&lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;print(j);&lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;&lt;SPAN style="white-space: normal;"&gt;&lt;SPAN style="white-space:pre;"&gt; &lt;/SPAN&gt;print(i);&lt;/SPAN&gt;&lt;/P&gt;
 &lt;P&gt;}&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 08 Apr 2025 21:59:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598334#M92581</guid>
      <dc:creator>a600</dc:creator>
      <dc:date>2025-04-08T21:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: Reset Label via FlexScript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598335#M92582</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;&lt;EM&gt;location&lt;/EM&gt; is an object property. If you want to set a label with that name, you have to use "processor.labels["location"].value = ...". It is recommended to avoid using such names. Using a capital letter at the start of label names makes sure that they do not coincide with property names.&lt;/P&gt;&lt;P&gt;The processor variable in your code is assigned a reference to an entire group, instead of a single object. If I understood your goal correctly (number the objects in each group from 1 to N), then the code should look like the following,&lt;/P&gt;&lt;PRE&gt;Array myGroups = ["Sourcing Group", "Conditioning Group", "Finishing Group", "Packing Group", "Distribution Group"];&lt;BR /&gt;Group curGroup;
for(int i = 1; i &amp;lt;= myGroups.length; i++)
{
&amp;nbsp; &amp;nbsp; curGroup = Group(myGroups&lt;I&gt;);
&amp;nbsp; &amp;nbsp; for(int j = 1; j &amp;lt;= curGroup.length; j++)
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Object processor = curGroup&lt;J&gt;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; processor.Location = j;
&amp;nbsp; &amp;nbsp; }
}&lt;/J&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Apr 2025 11:41:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598335#M92582</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2025-04-09T11:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Reset Label via FlexScript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598336#M92583</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Thank you for your answer! Does this code create the label Location, or does it assume it already exist? Is there a way to delete the original label location for all the objects in the group at once? Instead of clicking on the properties and deleting 1 by 1?
&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Apr 2025 14:08:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598336#M92583</guid>
      <dc:creator>aa48675TR7Z</dc:creator>
      <dc:date>2025-04-09T14:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: Reset Label via FlexScript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598337#M92584</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;The dot-syntax "object.labelName = ..." will create the label if it does not exist or overwrite the value if it does. The long form would be "processor.labels.assert("Location").value = ..."&lt;/P&gt;&lt;P&gt;To remove the other label you can add this into the innermost for-loop. With "object.labels["labelName"]" you access the label node rathen than the value. This allows you to delete the node (or change its name, among other things).&lt;/P&gt;&lt;PRE&gt;if(objectexists(processor.labels["location"]))&lt;BR /&gt;{
&amp;nbsp; &amp;nbsp; processor.labels["location"].destroy();
}&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Apr 2025 15:11:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598337#M92584</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2025-04-09T15:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reset Label via FlexScript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598338#M92585</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Thank you, that worked!
 &lt;P&gt;An additional question: can we set maximum content for processors using a reference to a Global Table? I tried but it says the field on accepts numbers.&lt;/P&gt;
 &lt;P&gt;Could we use Flexscript for this?&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Apr 2025 18:27:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598338#M92585</guid>
      <dc:creator>aa48675TR7Z</dc:creator>
      <dc:date>2025-04-09T18:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Reset Label via FlexScript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598339#M92586</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;You'd generally use a parameter table for this. But you can of course also read from a table and the set the maximum content accordingly (for example in the On Reset trigger of the processor).&lt;/P&gt;&lt;P&gt;You can check out the code that gets generated in the On Set trigger of the parameter for the needed command (object.setProperty()).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="capture1.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1527167i448FFEB0ABF281B2/image-size/large?v=v2&amp;amp;px=999" role="button" title="capture1.png" alt="capture1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 10 Apr 2025 06:07:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/reset-label-via-flexscript/m-p/13598339#M92586</guid>
      <dc:creator>moehlmann_fe</dc:creator>
      <dc:date>2025-04-10T06:07:56Z</dc:date>
    </item>
  </channel>
</rss>

