Branching on null/empty value and storing the result

Hi All,

I am using the following steps in my flow service:

  1. Adapter service to retrieve data from a table—output is Tabledata

  2. Loop on TableData/results
    Now, there are some fields in the TableData output which may or may not have a value in each iteration of the loop. Say, one such field is AB.

I want to store the TableData field values in another document in each iteration. But I want to store only those fields which have a value.

For this, I am doing the following within the loop for the field AB:

  1. Branch on TableData/results/AB
    Map-Label $null—Don’t map the field to the document. This is for the case when the field has no value.
    Map-Label $default—Map the field to the document.
    This is the case when the field has a value.

I have to pass this newly formed document to the input of an EDI mapping service.

When I run the flow service, everytime the $default target step gets selected under the branch, irrespective of whether the field AB has a value or not.
The $null target step is never getting selected.

please help me in this regard.

Thanks a lot

Try using the branch with evaluate lables to true and put “TableData/results/AB = $null” for first MAP step and default for second one. That should take care of it.

Check the results/AB value to be sure it is null. Perhaps it is an empty string, which will not match with the $null label.

If you want to not map null nor empty values, a regex label can do the trick. Use the following as the label for “not null and not empty and not just spaces”.

/[^ ]/: MAP
$default: do nothing

if you are using switch then make label as no value “no $null or any value” try with empty string. it works. because from database you are getting empty values not null values.

Thanks for your reply. I tried the suggested logic, but now the default step is not selected even if there is no value in AB. Always, the step with the label “TableData/results/AB = $null” is getting selected. Please help me out.