Skip to main content
April 20, 2021
Question

How to use the property function with more that 3 parameters ?

  • April 20, 2021
  • 8 replies
  • 0 views

Hi,

I've found in an existing code application this function called with 5 parameters (please see below).

But the Appian documentation says that the Property function must have 3 parameters only. This code works, but throw an error in Design mode (exactly like the "if" function which can take more than 3 parameters). 

How would you replace this code ? with additional if conditions ? 

property(
  local!availabilityResponse,
  "body",
  "resources",
  "type",
  null
)

Regards

8 replies

stefanhelzle0001
April 20, 2021

Following code allows you to drill down into a nested data structure. I called it deepIndex(). The rule inputs are all of the "any" type.

Use it like

rule!deepIndex(
  data: local!availabilityResponse,
  path: {"body", "resources", "type"},
  default: null
)

if(
  isnull(ri!path),
  ri!data,
  reduce(
    index(_,_,ri!default),
    ri!data,
    ri!path
  )
)

April 20, 2021

Thanks a lot Stefan, but why the Property(5 params) works in code, but not in Design mode ?

stefanhelzle0001
April 20, 2021

AFAIK this is a hidden and not supported behavior.

davidg426798
March 31, 2026

For anyone who is coming to this old post, the correct answer is to do this:

property(
  local!availabilityResponse,
  {"body","resources","type"},
  {}
)

This will return the three fields when local!availabilityResponse is not null, or an empty list when it is.