Sort Custom allows you to do a custom sort of a list by calling another FLO to generate the value used to sort each item. For simple sorts, use the Sort function instead.

To use this function, you’ll need another FLO that calculates the sort value for an item. This Child FLO will be invoked once for each item in the list. Define fields on the event card that will be the inputs that are required to determine the sort value. Typically you will include a field for the item of the list, i.e. if the list is a list of text then one of the inputs should be text. You can also include as other inputs whatever your FLO will need to calculate the sort value. If you need to know the position of the current item inside the list, use the “Index” field from the Context section of the child FLO card. Then build the rest of the child FLO, ending with a Return card that returns a single value. The name for the value on the Return card doesn’t matter. Save the FLO and turn it on.

Now go back to the Sort Custom card, input the list you want to sort, and then select the FLO you just built.  The inputs will auto-populate, then you can map data into them. To map an input to accept each item of the list, click in that field and you will see a dropdown that includes Item - select that.  Or if your list is a list of objects, you may also see the schema of the object, i.e. the keys that it contains, and  you can also build your child FLO to accept those as inputs. In addition, you can drag in outputs from previous cards in the FLO - in that case, the same value will be used for each item in this list.

Input Fields

  • list: The input list that contains all of the items you want to sort
  • flo:  The child FLO that will be called once for each item in the list
  • with the following values (dynamically generated):  The inputs defined by the child FLO - these will populate after you select the child FLO using the Choose FLO dialog
  • concurrency:  The number of items in the list to process in parallel.  If it is important that the items are processed in sequence, use 1.  Otherwise a higher number like 5 or 10 will cause your FLO to complete sooner.

Output Fields

  • list: The output list that contains the items, sorted from smallest to largest using the values returned for each item by the provided child FLO. The type of output list should be set to match the type of the input list (e.g. list of text).

Example

  • You have a list of text, e.g. ["this","is","a","sample"]
  • You create a child FLO that accepts a text input and returns the length of the text
  • Using Sort Custom, provide the list input and choose the child FLO above. For the input to the child FLO, click and choose “Item” from the dropdown
  • The output list of the Sort will be: ["a","is","this","sample"] - sorted from shortest to longest