How to make a drop-down field concating multiple rows from a record?

Certified Associate Developer

I have a local variable local!allProcesses: rule!myGetAllProcesses().data which contains data from a database. The columns are processId, processName, processYear and processQuarter. I now want to have choiceLabels of a drop-down menu which combines processName, processYear and processQuarter. The corresponding choiceValues will be the processIds. Obviously, the following code works only as long as I have only a single row in the database:

  

  choiceLabels:  {
        concat(
          {
            local!AllProcesses.processName
          },
          " for ",
          {
            local!AllProcesses.processYear
          },
          " Q",
          {
            local!AllProcesses.processQuarter
          }
        )
      },
      choiceValues: {local!allProcesses.processId},

Otherwise, for more than one row in the database, the error code will read

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!dropdownField [line 9]: A dropdown component [label=“Process”] has an invalid value for “choiceValues”. The choiceLabels and choiceValues arrays must be the same length, but choiceLabels was length 1 and choiceValues was length 2.

My question is: How to implement the merging of rows in the most efficient fashion, ideally in the interface itself? I read quite some old threads here in the community, and apparently in the newest Appian version there is a simple solution for it without introducing an expression rule or even a new, derived column in the database. Any guidance would be much appreciated!

  Discussion posts and replies are publicly visible

Parents Reply Children