Manipulation Filters

  • coalesce - Provides an alternative value for null values

  • entries - Gets the entries of an object and returns them as an array

  • fill - Create an array of a certain size with a default value.

  • fill_keys - Create an array of keys with a default value.

  • get - Gets a value at a specified path inside an object and returns a default value if it isn't found

  • has - Returns the existence of whether or not something is present in the object at the specified path

  • keys - Gets the keys of an object and returns them as an array

  • set - Sets a value of a specific path inside of an object

  • unset - Unsets (removes) a specific key from inside an object

  • values - Gets the values of an object and returns them as an array

  • create_object_from_entries - Creates an object based on an array of key/value pairs.

Conditional Set Filters

  • first_notempty - returns the first value that is not empty

  • first_notnull - returns the first value that is not null

  • set_ifnotempty - Good for updating objects.

  • set_ifnotnull - Similar to above, but useful for when you are dealing with null values.

  • set_conditional - sets a value at a specified path based on a conditional

For all examples of these filters we will use the same Object:

{
  "a": "1",
  "b": "2",
  "c": "3"
}

coalesce

This is a special SQL filter for handling null values. It will provide an alternative value for null values. This may especially come in handy for sorting with joined data. It is only available on evals in the Query All Records function.

The below example shows the query results when sorted in descending order by deal.merchant_id WITHOUT a coalesce filter applied.

With the coalesce filter applied, the null value takes on the substituted value.


entries

Get the property entries of an object as an array of key/value pairs.


fill

Create an array of a certain size with a default value.


fill_keys

Create an array of keys with a default value.


get

Returns the value of an object at the specified path, the path is the key of each pair, in this example, the path could be: a, b, or c.

You can also use inline expressions to make GET even more powerful. Read more here.


has

Returns the existence of whether or not something is present in the object at the specified path, the path is the key of each pair, in this example the path could be: a, b, or c. This filter returns a value of true or false.


keys

Get the property keys of an object as an Array.


set

Sets a value at the path within the object and returns the updated object.

The filter will parse the path using Xano Expression syntax. On some external APIs and in other rare cases, you may be trying to use a path that looks like an expression. If this is the case, make sure to wrap your path in [" and "] to ensure it behaves as expected.

You can also use inline expressions to make SET even more powerful. Read more here.


unset

Removes a value at the path within the object and returns the updated object.


values

Get the property values of an object as an Array:


create_object_from_entries

Creates an object based on an array of key/value pairs.

If you have an array of objects with key / value pairs, you can use this filter to consolidate them back into a single object. This can be useful if, for example, you are removing empty values from a list of key / value pairs, and then want them returned as a single object.

Last updated