displayvalue function

Certified Associate Developer
As displayvalue function description says it will return List of values but when try below example(real time scenario also) it returns only first matching value.Please let me know which scenario it will return List.

----------------------------

displayvalue(1,{1,2,3,1,4,1},{"A","B","C","A","D","A"},{})

Returns A.
Expecting A;A;A

---------------------------
Thanks in Advance

OriginalPostID-254102

  Discussion posts and replies are publicly visible

  • In case, if the value of 1 in the first array always has A in the second array and the same pattern follows always, then you may do as follows:

    repeat(
              fn!length(wherecontains(1,{1,2,3,1,4,1})),
              displayvalue(1,{1,2,3,1,4,1},{"A","B","C","A","D","A"},{})
    )
  • Try this instead: index({"A","B","C","A","D","A"}, wherecontains(1, {1,2,3,1,4,1}), {})

    Displayvalue is expecting only one entry in the corresponding array. This should work for you.
  • @pavani this is not the answer for your question. But you can learn more about displayvalue(). here is the scenario where you can use dispalyvalue()

    Return a CDT from an Array that Contains a Field Value Matching Another Value

    Use Case

    You have an array of department CDTs saved to a process variable called pv!departments each containing a field called Id, and you want to retrieve the CDT with an Id value matching the value of a process variable.

    Ingredients

    displayvalue()
    Process Variable: pv!departmentId (Integer)
    Process Variable: departments (CDT Array)
    Custom Data Type:

    department (Text)
    |- Id (Integer)
    |- Address (Text)
    Expression

    displayvalue(pv!departmentId, pv!departments.Id, pv!departments, "none")
    NOTE: To change the value that displays if the pv!departmentId doesn't match any department.Id values, modify the none text value as desired.