2 Replies Latest reply: Jan 10, 2013 10:22 AM by 983647 RSS

    Usage of business rules

    Suneel Jakka
      I have a invoice (EDI X12 894) and sending to B2B in order to send to trading partner but before sending to trading partner, we have to perform some validations before to be sent to trading partner. We have various validations based on the customer, so creating dictionary with "if then" rule sets for each customer.

      But each invoice has various lines, how can I do the validation on the lines. I have to loop through all the lines in the invoice and verify few segments whether they exist or not. So planning to create function within business rules and with function args as list but how can I perform the loop for all the invoice lines with in the function in business rules.

      Here is the sample payload of the invoice

      <Receive_894_Dequeue_InputVariable>
      <part name="XXDPI_EDI894_INVLIST_TYPE">
      <XXDPI_EDI894_INVLIST_TYPE>
      <INVLIST>
      <INVLIST_ITEM>
      <INV_NUMBER>13073309</INV_NUMBER>
      <STORE_NUMBER>701608</STORE_NUMBER>
      <VENDOR_NUM NULL="TRUE"/>
      <DELIVERY_DATE>20121119</DELIVERY_DATE>
      <TOTAL_QTY>6</TOTAL_QTY>
      <TOTAL_AMT>14802</TOTAL_AMT>
      <SIGNATURE>SIGN</SIGNATURE>
      <CHECK_VALUE>ABC</CHECK_VALUE>
      <TP_NAME>DEF</TP_NAME>
      <LINES>
      <LINES_ITEM>
      <SEQUENCE_NUM>1</SEQUENCE_NUM>
      <QUANTITY>1</QUANTITY>
      <UOM>EA</UOM>
      <ITEM_NUMBER>0001</ITEM_NUMBER>
      <PRICE>10.47</PRICE>
      <PACK>1</PACK>
      <ITEM_DESC>SAMPLE1</ITEM_DESC>
      <ALL_CODE NULL="TRUE"/>
      <ALL_METHOD NULL="TRUE"/>
      <ALL_RATE NULL="TRUE"/>
      <ALL_QTY NULL="TRUE"/>
      <ALL_UOM NULL="TRUE"/>
      <ATTRIBUTE1 NULL="TRUE"/>
      <ATTRIBUTE2 NULL="TRUE"/>
      <ATTRIBUTE3 NULL="TRUE"/>
      <ATTRIBUTE4 NULL="TRUE"/>
      <ATTRIBUTE5 NULL="TRUE"/>
      <ATTRIBUTE6 NULL="TRUE"/>
      <ATTRIBUTE7 NULL="TRUE"/>
      <ATTRIBUTE8 NULL="TRUE"/>
      <ATTRIBUTE9 NULL="TRUE"/>
      <ATTRIBUTE10 NULL="TRUE"/>
      </LINES_ITEM>
      <LINES_ITEM>
      <SEQUENCE_NUM>2</SEQUENCE_NUM>
      <QUANTITY>1</QUANTITY>
      <UOM>EA</UOM>
      <ITEM_NUMBER>0002</ITEM_NUMBER>
      <PRICE>8.55</PRICE>
      <PACK>1</PACK>
      <ITEM_DESC>SAMPLE2</ITEM_DESC>
      <ALL_CODE NULL="TRUE"/>
      <ALL_METHOD NULL="TRUE"/>
      <ALL_RATE NULL="TRUE"/>
      <ALL_QTY NULL="TRUE"/>
      <ALL_UOM NULL="TRUE"/>
      <ATTRIBUTE1 NULL="TRUE"/>
      <ATTRIBUTE2 NULL="TRUE"/>
      <ATTRIBUTE3 NULL="TRUE"/>
      <ATTRIBUTE4 NULL="TRUE"/>
      <ATTRIBUTE5 NULL="TRUE"/>
      <ATTRIBUTE6 NULL="TRUE"/>
      <ATTRIBUTE7 NULL="TRUE"/>
      <ATTRIBUTE8 NULL="TRUE"/>
      <ATTRIBUTE9 NULL="TRUE"/>
      <ATTRIBUTE10 NULL="TRUE"/>
      </LINES_ITEM>
      <LINES_ITEM>
      <SEQUENCE_NUM>3</SEQUENCE_NUM>
      <QUANTITY>1</QUANTITY>
      <UOM>CS</UOM>
      <ITEM_NUMBER>0003</ITEM_NUMBER>
      <PRICE>18.9</PRICE>
      <PACK>6</PACK>
      <ITEM_DESC>SAMPLE3</ITEM_DESC>
      <ALL_CODE>47</ALL_CODE>
      <ALL_METHOD>02</ALL_METHOD>
      <ALL_RATE>2.88</ALL_RATE>
      <ALL_QTY>1</ALL_QTY>
      <ALL_UOM>CS</ALL_UOM>
      <ATTRIBUTE1 NULL="TRUE"/>
      <ATTRIBUTE2 NULL="TRUE"/>
      <ATTRIBUTE3 NULL="TRUE"/>
      <ATTRIBUTE4 NULL="TRUE"/>
      <ATTRIBUTE5 NULL="TRUE"/>
      <ATTRIBUTE6 NULL="TRUE"/>
      <ATTRIBUTE7 NULL="TRUE"/>
      <ATTRIBUTE8 NULL="TRUE"/>
      <ATTRIBUTE9 NULL="TRUE"/>
      <ATTRIBUTE10 NULL="TRUE"/>
      </LINES_ITEM>
      <LINES_ITEM>
      <SEQUENCE_NUM>4</SEQUENCE_NUM>
      <QUANTITY>1</QUANTITY>
      <UOM>CS</UOM>
      <ITEM_NUMBER>0004</ITEM_NUMBER>
      <PRICE>45.19</PRICE>
      <PACK>1</PACK>
      <ITEM_DESC>SAMPLE4 </ITEM_DESC>
      <ALL_CODE NULL="TRUE"/>
      <ALL_METHOD NULL="TRUE"/>
      <ALL_RATE NULL="TRUE"/>
      <ALL_QTY NULL="TRUE"/>
      <ALL_UOM NULL="TRUE"/>
      <ATTRIBUTE1 NULL="TRUE"/>
      <ATTRIBUTE2 NULL="TRUE"/>
      <ATTRIBUTE3 NULL="TRUE"/>
      <ATTRIBUTE4 NULL="TRUE"/>
      <ATTRIBUTE5 NULL="TRUE"/>
      <ATTRIBUTE6 NULL="TRUE"/>
      <ATTRIBUTE7 NULL="TRUE"/>
      <ATTRIBUTE8 NULL="TRUE"/>
      <ATTRIBUTE9 NULL="TRUE"/>
      <ATTRIBUTE10 NULL="TRUE"/>
      </LINES_ITEM>
      <LINES_ITEM>
      <SEQUENCE_NUM>5</SEQUENCE_NUM>
      <QUANTITY>1</QUANTITY>
      <UOM>CS</UOM>
      <ITEM_NUMBER>0005</ITEM_NUMBER>
      <PRICE>50.93</PRICE>
      <PACK>1</PACK>
      <ITEM_DESC>SAMPLE5</ITEM_DESC>
      <ALL_CODE NULL="TRUE"/>
      <ALL_METHOD NULL="TRUE"/>
      <ALL_RATE NULL="TRUE"/>
      <ALL_QTY NULL="TRUE"/>
      <ALL_UOM NULL="TRUE"/>
      <ATTRIBUTE1 NULL="TRUE"/>
      <ATTRIBUTE2 NULL="TRUE"/>
      <ATTRIBUTE3 NULL="TRUE"/>
      <ATTRIBUTE4 NULL="TRUE"/>
      <ATTRIBUTE5 NULL="TRUE"/>
      <ATTRIBUTE6 NULL="TRUE"/>
      <ATTRIBUTE7 NULL="TRUE"/>
      <ATTRIBUTE8 NULL="TRUE"/>
      <ATTRIBUTE9 NULL="TRUE"/>
      <ATTRIBUTE10 NULL="TRUE"/>
      </LINES_ITEM>
      </LINES>
      <ATTRIBUTE1>007908809</ATTRIBUTE1>
      <ATTRIBUTE2>081191017</ATTRIBUTE2>
      <ATTRIBUTE3>000000</ATTRIBUTE3>
      <ATTRIBUTE4 NULL="TRUE"/>
      <ATTRIBUTE5 NULL="TRUE"/>
      <ATTRIBUTE6 NULL="TRUE"/>
      <ATTRIBUTE7 NULL="TRUE"/>
      <ATTRIBUTE8 NULL="TRUE"/>
      <ATTRIBUTE9 NULL="TRUE"/>
      <ATTRIBUTE10 NULL="TRUE"/>
      </INVLIST_ITEM>
      </INVLIST>
      </XXDPI_EDI894_INVLIST_TYPE>
      </part>
      </Receive_894_Dequeue_InputVariable>

      Regards,
      Suneel Jakka