Map() function

What is map function what it does and how we use it.

I see in some interfaces it has been used in ruleinputs as a datatype.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Hi maps are used to store data values as a key-value concept for more please check this out https://docs.appian.com/suite/help/22.3/fnc_system_map.html

  • Please elaborate I have seen the doc but still not sure can you please give an example

  • 0
    Certified Lead Developer
    in reply to Mh q

    What are you not sure about? If you want to know how it is used check the below code.

    =a!localVariables(
      local!items: {
        a!map(item: "Item 1", qty: 1, unitPrice: 10),
        a!map(item: "Item 2", qty: 2, unitPrice: 20)
      },
      a!gridLayout(
        label: "Products",
        instructions: "Update the item name, quantity, or unit price.",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Item"),
          a!gridLayoutHeaderCell(label: "Qty"),
          a!gridLayoutHeaderCell(label: "Unit Price"),
          a!gridLayoutHeaderCell(label: "Total", align: "RIGHT")
        },
        rows: {
          a!gridRowLayout(
            contents: {
              a!textField(
                value: local!items[1].item,
                saveInto: local!items[1].item
              ),
              a!integerField(
                value: local!items[1].qty,
                saveInto: local!items[1].qty
              ),
              a!floatingPointField(
                value: local!items[1].unitPrice,
                saveInto: local!items[1].unitPrice
              ),
              a!textField(
                value: dollar(tointeger(local!items[1].qty) * todecimal(local!items[1].unitPrice)),
                readOnly: true,
                align: "RIGHT"
              )
            }
          ),
          a!gridRowLayout(
            contents: {
              a!textField(
                value: local!items[2].item,
                saveInto: local!items[2].item
              ),
              a!integerField(
                value: local!items[2].qty,
                saveInto: local!items[2].qty
              ),
              a!floatingPointField(
                value: local!items[2].unitPrice,
                saveInto: local!items[2].unitPrice
              ),
              a!textField(
                value: dollar(tointeger(local!items[2].qty) * todecimal(local!items[2].unitPrice)),
                readOnly: true,
                align: "RIGHT"
              )
            }
          )
        },
        rowHeader: 1
      )
    )
    

Reply
  • 0
    Certified Lead Developer
    in reply to Mh q

    What are you not sure about? If you want to know how it is used check the below code.

    =a!localVariables(
      local!items: {
        a!map(item: "Item 1", qty: 1, unitPrice: 10),
        a!map(item: "Item 2", qty: 2, unitPrice: 20)
      },
      a!gridLayout(
        label: "Products",
        instructions: "Update the item name, quantity, or unit price.",
        headerCells: {
          a!gridLayoutHeaderCell(label: "Item"),
          a!gridLayoutHeaderCell(label: "Qty"),
          a!gridLayoutHeaderCell(label: "Unit Price"),
          a!gridLayoutHeaderCell(label: "Total", align: "RIGHT")
        },
        rows: {
          a!gridRowLayout(
            contents: {
              a!textField(
                value: local!items[1].item,
                saveInto: local!items[1].item
              ),
              a!integerField(
                value: local!items[1].qty,
                saveInto: local!items[1].qty
              ),
              a!floatingPointField(
                value: local!items[1].unitPrice,
                saveInto: local!items[1].unitPrice
              ),
              a!textField(
                value: dollar(tointeger(local!items[1].qty) * todecimal(local!items[1].unitPrice)),
                readOnly: true,
                align: "RIGHT"
              )
            }
          ),
          a!gridRowLayout(
            contents: {
              a!textField(
                value: local!items[2].item,
                saveInto: local!items[2].item
              ),
              a!integerField(
                value: local!items[2].qty,
                saveInto: local!items[2].qty
              ),
              a!floatingPointField(
                value: local!items[2].unitPrice,
                saveInto: local!items[2].unitPrice
              ),
              a!textField(
                value: dollar(tointeger(local!items[2].qty) * todecimal(local!items[2].unitPrice)),
                readOnly: true,
                align: "RIGHT"
              )
            }
          )
        },
        rowHeader: 1
      )
    )
    

Children
No Data