Forum Discussion

JennasonQuick_B's avatar
JennasonQuick_B
Qrew Trainee
13 days ago

Branching a pipeline based on the number of records in a fetched JSON

Currently my pipeline:

  1. Does a JSON Fetch to retrieve a JSON response
  2. Does an Iterate over JSON records

After the iterate I'd like to add a condition step that checks whether the # of JSON records is exactly 2   and then branch accordingly

My iterate JSON step is Step 'd'.   I'm trying to figure out the right syntax to use in my condition step.

In the advanced expression of my condition step I've tried  {{ d | count}}=2   {{ d | count}}==2   {{ d | length}}=2   {{ d | length}}==2   and all always resolve to 'True' even when the returned json only has 1 record

Any help is appreciated.

  • Try this:

    {{ d | count == 2 }}

    The expected return value of the above would be TRUE. The expected return value of {{ d | count}}==2 would be string literal 2==2 because it is not encapsulated in the curly braces.

1 Reply

  • Try this:

    {{ d | count == 2 }}

    The expected return value of the above would be TRUE. The expected return value of {{ d | count}}==2 would be string literal 2==2 because it is not encapsulated in the curly braces.