<?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: Combining multiple flow items based on label in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575182#M74580</link>
    <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hello &lt;A rel="user" href="https://answers.flexsim.com/users/42485/vns.html" nodeid="42485"&gt;@Vns&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;The only thing you are missing with implementing what you found is you need to change your MatchedOrder and Order to be integer variables instead of strings and use 0 instead of a blank string.&lt;/P&gt;&lt;PRE&gt;/**Custom Code*/
treenode current = ownerobject(c);
treenode item = param(1);
int port =  param(2);
&lt;SPAN style="color: rgb(97, 189, 109);"&gt;int&lt;/SPAN&gt; MatchedOrder = current.MatchedOrder;

if (MatchedOrder != &lt;SPAN style="color: rgb(97, 189, 109);"&gt;0&lt;/SPAN&gt;) {
    //We previously matched an item so pull the matching order from the other queue
    if (item.pallet_id == MatchedOrder) {
        current.MatchedOrder = &lt;SPAN style="color: rgb(97, 189, 109);"&gt;0&lt;/SPAN&gt;;
        return 1;
    }
    return 0;
}
 
&lt;SPAN style="color: rgb(97, 189, 109);"&gt;int&lt;/SPAN&gt; Order = item.pallet_id;
//Search the opposite queue for the same order
int otherPort = port % 2 + 1; //Grab the other port rank so we look at the other queue
treenode queue = current.as(Object).inObjects[otherPort];
for (int i = 1; i &amp;lt;= queue.subnodes.length; i++) {
    if (queue.subnodes&lt;I&gt;.pallet_id == Order) {
        //Found a matching order, save the order on a label
        current.MatchedOrder = Order;
        //Now pull the item that just entered the original queue
        return 1;
    }
   
}
//No matches, pull nothing
return 0;&lt;/I&gt;&lt;/PRE&gt;&lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/temp/73314-test1-1.fsm" target="_blank"&gt;test1_1.fsm&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 05 Sep 2023 15:57:01 GMT</pubDate>
    <dc:creator>Jeanette_Fullmer</dc:creator>
    <dc:date>2023-09-05T15:57:01Z</dc:date>
    <item>
      <title>Combining multiple flow items based on label</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575181#M74579</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 23.2.0 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/73310-test1.fsm" target="_blank"&gt;test1.fsm&lt;/A&gt;&lt;/P&gt;
 &lt;P id="isPasted"&gt;Hi all - I need some help with combining multiple flow items(totes) ; with the label (pallet_id) to the similar base pallet . However it seem that the combiner is not pulling the items from either queue (Split_1 /Queue 9). I there something I missed or overlooked&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1693927591822.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1519306iC2F2C1F13BDE4BF8/image-size/large?v=v2&amp;amp;px=999" role="button" title="1693927591822.png" alt="1693927591822.png" /&gt;&lt;/span&gt;&lt;/P&gt;
 &lt;P&gt;&lt;BR /&gt;&lt;/P&gt;
 &lt;P&gt;I based my model on a related thread : &lt;A rel="nofollow" href="https://answers.flexsim.com/questions/120216/combine-items-with-matching-string-label.html"&gt;HERE&lt;/A&gt;&lt;/P&gt;
 &lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 05 Sep 2023 15:29:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575181#M74579</guid>
      <dc:creator>Vns</dc:creator>
      <dc:date>2023-09-05T15:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple flow items based on label</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575182#M74580</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hello &lt;A rel="user" href="https://answers.flexsim.com/users/42485/vns.html" nodeid="42485"&gt;@Vns&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;The only thing you are missing with implementing what you found is you need to change your MatchedOrder and Order to be integer variables instead of strings and use 0 instead of a blank string.&lt;/P&gt;&lt;PRE&gt;/**Custom Code*/
treenode current = ownerobject(c);
treenode item = param(1);
int port =  param(2);
&lt;SPAN style="color: rgb(97, 189, 109);"&gt;int&lt;/SPAN&gt; MatchedOrder = current.MatchedOrder;

if (MatchedOrder != &lt;SPAN style="color: rgb(97, 189, 109);"&gt;0&lt;/SPAN&gt;) {
    //We previously matched an item so pull the matching order from the other queue
    if (item.pallet_id == MatchedOrder) {
        current.MatchedOrder = &lt;SPAN style="color: rgb(97, 189, 109);"&gt;0&lt;/SPAN&gt;;
        return 1;
    }
    return 0;
}
 
&lt;SPAN style="color: rgb(97, 189, 109);"&gt;int&lt;/SPAN&gt; Order = item.pallet_id;
//Search the opposite queue for the same order
int otherPort = port % 2 + 1; //Grab the other port rank so we look at the other queue
treenode queue = current.as(Object).inObjects[otherPort];
for (int i = 1; i &amp;lt;= queue.subnodes.length; i++) {
    if (queue.subnodes&lt;I&gt;.pallet_id == Order) {
        //Found a matching order, save the order on a label
        current.MatchedOrder = Order;
        //Now pull the item that just entered the original queue
        return 1;
    }
   
}
//No matches, pull nothing
return 0;&lt;/I&gt;&lt;/PRE&gt;&lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/temp/73314-test1-1.fsm" target="_blank"&gt;test1_1.fsm&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 05 Sep 2023 15:57:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575182#M74580</guid>
      <dc:creator>Jeanette_Fullmer</dc:creator>
      <dc:date>2023-09-05T15:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple flow items based on label</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575183#M74581</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Hi 
 &lt;A rel="user" href="https://answers.flexsim.com/users/24344/jeanettef.html" nodeid="24344"&gt;@Jeanette F&lt;/A&gt; thanks so much for pointing that out. 
 &lt;P&gt;However, i do have other totes still on the queue under the same pallet id which need to be pull to the combiner. &lt;/P&gt;
 &lt;P&gt;Is there a way i could read the number of relevant tote on the queue to set the target quantity on the combiner ? &lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Sep 2023 14:59:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575183#M74581</guid>
      <dc:creator>Vns</dc:creator>
      <dc:date>2023-09-06T14:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple flow items based on label</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575184#M74582</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hello &lt;A rel="user" href="https://answers.flexsim.com/users/42485/vns.html" nodeid="42485"&gt;@Vns&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;I think it would be best to have a label on the pallet that says how many totes it is expecting and that label is what then determines how many to pull. Is that reasonable for your application?&lt;/P&gt;&lt;P&gt;Or do you just need to set the value to 7 in the combiner since it is 7 in the first combiner and I do not see you altering it?&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Sep 2023 16:43:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575184#M74582</guid>
      <dc:creator>Jeanette_Fullmer</dc:creator>
      <dc:date>2023-09-06T16:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple flow items based on label</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575185#M74583</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Hi 
 &lt;A rel="user" href="https://answers.flexsim.com/users/24344/jeanettef.html" nodeid="24344"&gt;@Jeanette F&lt;/A&gt; - i do have a randomize split on SEP_1 therefore the number of tote will only be determine on queue 9. 
 &lt;P&gt;I'm assuming the combiner target must be dynamic to register the new qty after the split.&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 07 Sep 2023 01:03:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575185#M74583</guid>
      <dc:creator>Vns</dc:creator>
      <dc:date>2023-09-07T01:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple flow items based on label</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575186#M74584</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Hello &lt;A rel="user" href="https://answers.flexsim.com/users/42485/vns.html" nodeid="42485"&gt;@Vns&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I see that now. In this case you will want to add an On Entry trigger to the combiner. Start with the picklist option Update Combiner Component List with Labels.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="1694119266156.png"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1519305iD6F703BF11ADEC9C/image-size/large?v=v2&amp;amp;px=999" role="button" title="1694119266156.png" alt="1694119266156.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This option has you update the component list from a global table. We will edit it to look like the following.&lt;/P&gt;&lt;PRE&gt;Object current = ownerobject(c);
Object item = param(1);
int port = param(2);
{ // ************* PickOption Start ************* //
/***popup:CombinerComponentListLabel*/
/**Update Combiner Component List*/
string tablename = /** \nTable: *//***tag:table*//**/"tablename"/**/;
string labelname = /** \nLabel: *//***tag:label*//**/"nooftote"/**/;
/** \n\nNote:
This option should only be used on Combiners.*/
/**\n*/
if (port == 1) {  
   //The trigger on entry code fires each time a flow item enters the combiner.
   //For this reason we check to make sure that the port entered is equal to 1
   //because only the container will enter through port 1.

  //The component list in a combiner is set up as a table.  This allows us to use the cell commands to obtain the node that contains
  //the number of items to retrieve from each port.  Once you know what node contains the information you can use the setnodenum
  //command to set the component list number based on the global table.

  Table thelist = getvarnode(current, "componentlist");
  treenode thesum = getvarnode(current, "targetcomponentsum");
  thesum.value = 0;

  thelist[1][1] = item.labels[labelname].value;
  inc(thesum, item.labels[labelname].value);
 
}
} // ******* PickOption End ******* //&lt;/PRE&gt;&lt;P&gt;I also changed the pull requirement to wait to change the Matched Order label till all the totes required had been pulled.&lt;/P&gt;&lt;PRE&gt;/**Custom Code*/
treenode current = ownerobject(c);
treenode item = param(1);
int port =  param(2);
int MatchedOrder = current.MatchedOrder;


if (MatchedOrder != 0) {
    //We previously matched an item so pull the matching order from the other queue
    if (item.pallet_id == MatchedOrder) {
        //see if capacity has been met
        if((getvarnum(current, "currentcomponentsum")+1) == getvarnum(current, "targetcomponentsum")){
current.MatchedOrder = 0;
}
        return 1;
    }
    return 0;
}
 
int Order = item.pallet_id;
//Search the opposite queue for the same order
int otherPort = port % 2 + 1; //Grab the other port rank so we look at the other queue
treenode queue = current.as(Object).inObjects[otherPort];
for (int i = 1; i &amp;lt;= queue.subnodes.length; i++) {
    if (queue.subnodes&lt;I&gt;.pallet_id == Order) {
        //Found a matching order, save the order on a label
        current.MatchedOrder = Order;
        //Now pull the item that just entered the original queue
        return 1;
    }
   
}
//No matches, pull nothing
return 0;&lt;/I&gt;&lt;/PRE&gt;&lt;P&gt;&lt;A rel="noopener noreferrer" href="https://answers.flexsim.com/storage/attachments/73406-test1-2.fsm" target="_blank"&gt;test1_2.fsm&lt;/A&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 07 Sep 2023 21:02:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575186#M74584</guid>
      <dc:creator>Jeanette_Fullmer</dc:creator>
      <dc:date>2023-09-07T21:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple flow items based on label</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575187#M74585</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;Thanks &lt;A rel="user" href="https://answers.flexsim.com/users/24344/jeanettef.html" nodeid="24344"&gt;@Jeanette F&lt;/A&gt; - will you be able to re-upload the model. The current doesn't seem to be downloadable. &lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Sep 2023 14:18:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575187#M74585</guid>
      <dc:creator>Vns</dc:creator>
      <dc:date>2023-09-08T14:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Combining multiple flow items based on label</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575188#M74586</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;Hello &lt;A rel="user" href="https://answers.flexsim.com/users/42485/vns.html" nodeid="42485"&gt;@Vns&lt;/A&gt;, &lt;P&gt;I reuploaded it&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Sep 2023 15:10:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/combining-multiple-flow-items-based-on-label/m-p/13575188#M74586</guid>
      <dc:creator>Jeanette_Fullmer</dc:creator>
      <dc:date>2023-09-08T15:10:58Z</dc:date>
    </item>
  </channel>
</rss>

