# How to use batch node in concatenate sequence mode

In this tutorial we are having a array of numbers which is a mix of negative and positive numbers. We need to filter and group all the positive and negative number respectively and batch both the group of positive and negative number into one sequence.

  1. TBD

    Following is the input to be used for this use case.

     [1,-6,-8,7,2,-3]
    
  2. Drag and drop a split node from routing section on the pallette to the canvas. Double click the split node and set the Split using under Array section with Fixed length of 1. This is to iterate the input array records and send one by one to the next node. Click Save.

  3. Wire the TBD to the split node.

  4. Place the switch node from the routing section to the canvas.Double click the routing node to open the node and set the following rules.

    > 0 --> route 1 otherwise --> route 2

  5. Drag and drop 2 set properties node to the canvas double click on the first Set properties node and Set the msg.topic to POS . Similarly double click on the second Set properties node and Set the msg.topic to NEG.

  6. Wire the route 1 representing > 0 in switch node to first Set properties node and wire the route 2 representing otherwise to Second Set properties node.

  7. Drop the batch node from the routing section to the pallette to the canvas and double click to open the batch node editor.

  8. Select the mode as Concatenate Sequence mode and Click Add button twice to add the topics . On the first added field set as NEG and second added field as POS.

  9. Wire the two Set properties node to the batch node which has been configured.

  10. Drop the join node from routing to the canvas and wire the batch node to join node.Keep all the values of join node as default.

  11. Drop the debug node and name it as Completed.

  12. Click on the TBD to test the flow.

Observation

The result of the flow printed on the debug panel in the editor for the debug node will be as follows.

[-6,-8,-3,1,7,2]

All the negative numbers as grouped first and positive number grouped and concatenated later.