In order to make a general purpose sub-process to do some lookups in an external

In order to make a general purpose sub-process to do some lookups in an external system, I want to return a key-value map to the calling process. In Appian this type of data structure seems to be known as a "dictionary".

The problem is that I don't see how the keys can be generated dynamically...

I can do this:
{key1: ri!value1, key2: ri!value2}
But then the keys are hardcoded.

If I do:
{ri!key1: ri!value1, ri!key2: ri!value2}
the result is (in the rule tester): [key1:xxx,key2:yyy]

i.e. the "ri!" is ignored and the key becomes the NAME of the rule input variable, rather than the VALUE of the rule input.

I can arrange to have an array of keys and an array of corresponding values, and there's a "merge()" function that would group them, but the result is just an array of arrays, grouped properly, but that's not a dictionary.

Is there something that would turn the result of a merge() into a dictionary, or some other way to dynamicall...

OriginalPostID-114385

OriginalPostID-114385

  Discussion posts and replies are publicly visible

Parents
  • Thanks. The CDT you suggest is exactly what I already have. displayvalue() seems to work nicely to retrieve one field:
    displayvalue("FirstName",pv!queryResult.fields.name,pv!queryResult.fields.value,"n/a")
    This isn't as efficient as a dictionary, but is much better than using a string-based keyval.

    I would rather have done something like:
    pv!queryResult.fields.FirstName, but I can wrap the displayvalue() a rule so that I can do:
    rule!getQueryResultFieldValue(pv!queryResult,"FirstName")
    and this gets me what I want.
Reply
  • Thanks. The CDT you suggest is exactly what I already have. displayvalue() seems to work nicely to retrieve one field:
    displayvalue("FirstName",pv!queryResult.fields.name,pv!queryResult.fields.value,"n/a")
    This isn't as efficient as a dictionary, but is much better than using a string-based keyval.

    I would rather have done something like:
    pv!queryResult.fields.FirstName, but I can wrap the displayvalue() a rule so that I can do:
    rule!getQueryResultFieldValue(pv!queryResult,"FirstName")
    and this gets me what I want.
Children
No Data