Skip to main content

removeFromAtlObject

Removes key–value pairs from an ATL object.

For more about ATL objects, see ATL Guide > ATL objects.

Parameters

  • OBJECT (ATL object)

    The ATL object from which to remove key–value pairs.

  • KEYS (string or list)

    The key name for any key–value pair you want to remove.

    To remove a key–value pair, give the key name as a string. For multiple keys, input a list.

Examples

To remove a key–value pair, give the key name as a string.

[[

myObject = (product = 'Ointmo', Q1sales = 21624, Q2sales = 30714, salesDiff = 9090, pctChange = 42)

removeFromAtlObject(myObject, 'pctChange')

]]

The amended ATL object is:

( product = Ointmo, Q1sales = 21624, Q2sales = 30714, salesDiff = 9090 )

Note

The original myObject had five key–value pairs; the amended object has four.

To remove multiple key–value pairs, input a list of key names to the second parameter.

[[

myObject = (product = 'Ointmo', Q1sales = 21624, Q2sales = 30714, salesDiff = 9090, pctChange = 42)

keysToRemove = makeList('Q2sales', 'salesDiff', 'pctChange')

removeFromAtlObject(myObject, keysToRemove)

]]

The amended ATL object is:

( product = Ointmo, Q1sales = 21624 ) 

When a given key name isn’t in the object, the function ignores it and removes the key–value pairs it can.

[[

myObject = (product = 'Ointmo', Q1sales = 21624, Q2sales = 30714, salesDiff = 9090, pctChange = 42)

keysToRemove = makeList('Q2sales', 'salesDiff', 'profit')

removeFromAtlObject(myObject, keysToRemove)

]]

The amended ATL object is:

( product = Ointmo, Q1sales = 21624, pctChange = 42 )

Note

If no given key names are in the input object, the function returns the object unchanged.