Update specific field on specific index

Hello All,

I just want to know how can I update a specific field to a specific index? example is I have 3 list of items, and I only want to update the 2nd index first name to "Jerry" and not "Henry". I tried to use updatearray() but its only updating the whole data or I am missing something? 

{

index: 1,

name: "John",

lastName: "Doe"

},


{

index: 2,

name: "Henry",

lastName: "Doe"

},


{

index: 3,

name: "Jenny",

lastName: "Doe"

},

Looking forward to anyone reply. Thank you!

  Discussion posts and replies are publicly visible

Parents
  • As an alternative for prior versions of Appian, the Dictionary Manipulation plugin is very useful for these sorts of things:

    a!localVariables(
      local!data: {
        { index: 1, name: "John", lastName: "Doe" },
        { index: 2, name: "Henry", lastName: "Doe" },
        { index: 3, name: "Jenny", lastName: "Doe" },
      },
      
      a!forEach(
        items: local!data,
        expression: if(
          fv!index=2,
          updatedictionary(
            fv!item,
            {
              name: "Jerry"
            }
          ),
          fv!item
        )
      )
    )

  • Here

    a!localVariables(
    local!data: {
    { index: 1, name: "John", lastName: "Doe" },
    { index: 2, name: "Henry", lastName: "Doe" },
    { index: 3, name: "Jenny", lastName: "Doe" },
    },
    local!result: a!forEach(
    items: local!data,
    expression: if(
    fv!index= 2,
    updatedictionary(
    fv!item,
    {
    name: "Jerome"
    }
    ),
    fv!item
    )
    ),
    a!forEach(
    items: local!result,
    expression: if(
    fv!index= 3,
    updatedictionary(
    fv!item,
    {
    name: "Justine"
    }
    ),
    fv!item
    )
    )
    )

Reply
  • Here

    a!localVariables(
    local!data: {
    { index: 1, name: "John", lastName: "Doe" },
    { index: 2, name: "Henry", lastName: "Doe" },
    { index: 3, name: "Jenny", lastName: "Doe" },
    },
    local!result: a!forEach(
    items: local!data,
    expression: if(
    fv!index= 2,
    updatedictionary(
    fv!item,
    {
    name: "Jerome"
    }
    ),
    fv!item
    )
    ),
    a!forEach(
    items: local!result,
    expression: if(
    fv!index= 3,
    updatedictionary(
    fv!item,
    {
    name: "Justine"
    }
    ),
    fv!item
    )
    )
    )

Children
No Data