Index attribute within a!update() function seems to be case insensitive

Certified Lead Developer

We often use a!update() function to update dictionary values however, it fails when a dictionary has 2 attributes with different font cases (e.g. label & LABEL)

In 21.4 I tried using the a!update() function as below:

Input

{
label:"",
LABEL:"asdf",
label3:"",
label4:"asdf"
}

Rule
a!update(ri!dict,"LABEL",123)

Output: 

{label: 123, LABEL: "asdf", label3: "", label4: "asdf"}

Is there another function that I can use to avoid this? I do not want to recreate the entire dictionary each time someone updates a single value.

  Discussion posts and replies are publicly visible

Parents
  • If you don't care about the order of your dictionary you can use the below code. This was just a quick formulation so if the order is important I'm sure this could be achieved as well as validation checks to see if a!update() would work. But this at least proves the concept.

    Appian is a little inconsistent with what is and isn't case sensitive. For example if you're checking for a valid username before creating a user using the isusernametaken() function then this is case sensitive. But account creation is case insensitive so if you check for "Appian" and it's available your user creation may still fail if there is a user "appian" (or any permutation where only the case differs). Frustrating.

    a!localVariables(
      local!data: {
        label:"",
        LABEL:"asdf",
        label3:"",
        label4:"asdf"
      },
      local!fieldToUpdate: "LABEL",
      local!newValue: 123,
      insert(
        remove(
          local!data,
          local!fieldToUpdate
        ),
        local!newValue,
        local!fieldToUpdate
      )
    )

Reply
  • If you don't care about the order of your dictionary you can use the below code. This was just a quick formulation so if the order is important I'm sure this could be achieved as well as validation checks to see if a!update() would work. But this at least proves the concept.

    Appian is a little inconsistent with what is and isn't case sensitive. For example if you're checking for a valid username before creating a user using the isusernametaken() function then this is case sensitive. But account creation is case insensitive so if you check for "Appian" and it's available your user creation may still fail if there is a user "appian" (or any permutation where only the case differs). Frustrating.

    a!localVariables(
      local!data: {
        label:"",
        LABEL:"asdf",
        label3:"",
        label4:"asdf"
      },
      local!fieldToUpdate: "LABEL",
      local!newValue: 123,
      insert(
        remove(
          local!data,
          local!fieldToUpdate
        ),
        local!newValue,
        local!fieldToUpdate
      )
    )

Children
No Data