Change List in Microflow

Hi there, I have an interesting challenge right now: I have a database with different columns (let’s say A, B, C, D). Then I have Microflow that asks the user for input on these 4 columns and returns a filtered list (with which the user then works in the app) based on the line items from the database that match the condition set in the filter. So basically my XPath for the Retrieve List I run in my Microflow looks like this (set up the name variables prior to the Retrieve List) [DatabaseTable/A = $AName  and DatabaseTable/B = $BName and DatabaseTable/C = $CName and DatabaseTable/D = $DName] My challenge now is that the dropdowns for A, B, and C are mandatory and always filled “with something”, however, I want to have D optional.  This means I need to adjust the Retrieve List in a way that it says for D If D is not empty, use D as a filter (just like the other ones) ElseIf D is empty, keep the list as it as long as the first three conditions (A, B, C) are met.
4 answers

You can implement solution as Dinesh suggested or else you can add a decision to check if $DName!=empty and have two flows with retrieve action set accordingly (with or without $DName)


Finally, with the help of the great contributors to this thread, I was able to solve my problem.

What I basically do is the following steps

  1. Create an empty list
  2. have a decision if the $variable from the input form is empty or not
  3. if it is empty: create a temp list (step 3a) holding the values and then change the existing empty list by adding contents of the temp list (step 3b)
  4. if it is not empty: create another temp list (step 4a) holding the values and then change the existing empty list by adding contents of the temp list (step 4b)
  5. Merge both paths together before ending the Microflow


This picture / screenshot might make it a lot clearer :)


You can retrieve the list and then using Filter action in List operation  you add your criteria and only take list you want.


I would go for the solutions as  Dinesh and Neela suggested. 

However, this works (9.12.0): 

[DatabaseTable/A = $AName 
and DatabaseTable/B = $BName
and DatabaseTable/C = $CName

( $DName = empty


(DatabaseTable/D != empty and DatabaseTable/D = $DName ) )