64480 - no subject - I have two arrays in process model conta

I have two arrays in process model containing FirstName and LastName in it. I am reporting on this process model. I want to display Name(FirstName LastName) as single column on report. I am trying to use doForEach to achieve so, but it doesnt appear to be working on report. Any help/suggestion? Thanks....

OriginalPostID-64480

  Discussion posts and replies are publicly visible

  • You could create a rule called "combineNames", with two text inputs: firstName, lastName.
    =ri!firstName&" "&ri!lastName
    You can then apply this rule as follows:
    apply(rule!combineNames,merge(pv!arrayOfFirstNames,pv!arrayOfLastNames))
    The output of that will be a list of strings, each string being a first and last name separated by a space.
  • Thanks Harrison, I am using version 6.6, i do not see apply and merge functions there. Any suggestions on 6.6
  • Neither doforeach() nor looping functions are available in reports, so you would need to perform the expression in the process and save the results into a pv which could be displayed on the report.

    That said, are you trying to display the array elements in different rows of the process model report? This will not work as there will be a single row per process instance of the model. Perhaps you could explain your use case?
  • I have two array, one for User Last Names another for User First Names in a Process Model. On a report built on the process model instances, i want to display Full User Name.
    I can store Full User name in a new Array and display it on report, but the issue is existing instances will not have this new PV and user name value for those instance would not be displayed.
  • Displaying an array pv in a report will display the entire array, separated by semi-colons, in a single cell (It will look like "name 1; name 2; name 3".) Is this what you want?
  • array1={John, Kiran, Vik}
    array2={Kerry, Point, Kant}
    I want to display this in report like below
    {John Kerry, Kiran Point, Vik Kant} on report instance.
  • Hi, Ambrish. If you have the opportunity to refine your process, we would definitely recommend either storing the concatenated values in process or use a multi-valued User process variable to store users. Appian is quite good at displaying multiple users in a single cell value of a report.

    I was able to create a recursive expression rule that takes your arrays as input and builds a string. Once the length of the arrays is exceeded, it returns the names. This method could have a big impact on report performance, so make sure you test for any performance implications. This is definitely not a best practice.

    In my example, the rule has inputs for the first names, last names, a count, and the returnString.

    if(ri!count > length(ri!firstNameArray), mid(ri!returnString, 4, len(ri!returnString) - 5), rule!returnNames(ri!firstNameArray, ri!lastNameArray, ri!count + 1, ri!returnString & index(ri!firstNameArray, ri!count, "") & " " & index(ri!lastNameArray, ri!count, "") & ", "))

    The report column definition would be: rule!returnNames(pv!firstNameArray, pv!lastNameArray, 0, "").

    The mid() function removes any leading/trailing comma's from the list of names.
  • Thanks Richard, can you re-check the rule provided by you, it appears to be having rule name inside rule.
  • That is correct. The rule calls itself, and that is what makes it recursive. It calls itself once for each name in the array.
  • You can try with following solution also if u r facing perfomance issue using recursion
    1. you can fixed this issue for newer instances by directly doing changes in process model(add new pv fullNameList)
    2. For Existing instancess follow following steps.
    a.Create pv in existing process using "IFM Manager"smart service with same name(fullNameList).
    b.Create one utility process model which will get both firstNameList and lastNameList from existing process using "Get External PV" smart service. create fullnamelist and update the pv fullnameList in existing process using "Set External PV" smart service.
    c. this will be one time activity if your firstnamelist and lastnamelist pvs not going to change existing instances.