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
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
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 ) )
The map is used to make your data as structured Data if CDT is not there for the same. It is like a key-value pair.
Basically the same thing as a dictionary, but with many other uses. It's an ad hoc CDT-like thing that you define by filling it with whatever. The cool thing is, unlike dictionary, you can pass it to a process model as a process variable and do lots of other things with it. It's really cool for determining the structure the data will go into at runtime, but it does have some limits.
Thank you all
In addition to being able to pass it to a process as a PV (which does open up some nice new doors, as it were), the biggest strength of a!map() over a traditional dictionary, is that the data items within the map will keep their data type very well. In a dictionary it was often hard to use certain primitive operators (like "local!dict.number = 1") because data elements in a dictionary would resolve as a sort of "any type" data type, which did not play well with direct comparisons like the above.