Forum Discussion

Max's avatar
Max
New Contributor II
2 years ago
Solved

sizeOf payload

Hello,

im trying to convert a MuleSoft API to snapLogic. In one of the Mule flows, a choice block is used and the expression sizeOf(payload)==1 is evaluated. How can this same logic be used in snap? Im having trouble accessing payload as snapLogic says payload is undefined. Im trying to use this in the router snap. Im trying to figure out how to write an expression that will evaluate the sizeOf the payload.

  • Max 

    The SQL Select Snap will not gives you the result as array. 

    So, after the SQL Select Snap try to group the output from the select, using Group by N snap, and then calculate the length of the group/array using the length function. 

3 Replies

  • Max's avatar
    Max
    New Contributor II

    How can this be done?? Im trying to get the sizeOf or length of the payload coming from a SQL select. The attachment shows what is returned from the SQL select. In the next step, how can I access payload from the router snap? There is no array available to do anything with?

    • SpiroTaleski's avatar
      SpiroTaleski
      Valued Contributor

      Max 

      The SQL Select Snap will not gives you the result as array. 

      So, after the SQL Select Snap try to group the output from the select, using Group by N snap, and then calculate the length of the group/array using the length function.