Hi, Im trying to fetch different constant values based on different c

Hi,

Im trying to fetch different constant values based on different conditions for choice labels and choice values of "Dropdown field", Each constant has 2 values, but it is returning only single value when I use "Like" conditions. If I use "=", all values of constants are returning. Please see the code below
ChoiceLabels:
if(
like(ri!cdtxyz.tfield,"*New*"),
cons!NEW_LABELS,
if(
like(ri!cdtxyz.tfield,"*Renewal*"),

cons!RENEWAL_LABELS,
if(
like(ri!cdtxyz.tfield,"*Modification*"),
cons!MODIFY_LABELS,
cons!TERMINATE_LABELS_))),

Similarly for Choice values also.

Please suggest any solution to return all values of constants, when like condition is matching

OriginalPostID-208632

OriginalPostID-208632

  Discussion posts and replies are publicly visible

Parents
  • This is the way Appian handles data. Most of the times it works like you expect it. But sometimes not. So in this case my explanation is: like() on a multiple returns a list of bools.

    =typename(runtimetypeof(like({"New"},"*New*"))) -> List of Boolean

    Now if() tries to evaluate a list of bools. Which works fine for:

    =if(
    {true,false,true},
    "a",
    "b"
    )

    But as you return lists of string for each case these creates a list of lists which is somehow flattened. This is where it breaks.

    So try to put the like() inside an or() or make sure that your ri variable is no multiple.
Reply
  • This is the way Appian handles data. Most of the times it works like you expect it. But sometimes not. So in this case my explanation is: like() on a multiple returns a list of bools.

    =typename(runtimetypeof(like({"New"},"*New*"))) -> List of Boolean

    Now if() tries to evaluate a list of bools. Which works fine for:

    =if(
    {true,false,true},
    "a",
    "b"
    )

    But as you return lists of string for each case these creates a list of lists which is somehow flattened. This is where it breaks.

    So try to put the like() inside an or() or make sure that your ri variable is no multiple.
Children
No Data