Hi Team,
How to delete multiple keys from a Map in Daml?
Key deletion for single element :
M.delete “ABC” dataMap
In similar to above what is the syntax to delete lets says “ABD” and “XYZ” keys from dataMap.
Hi Team,
How to delete multiple keys from a Map in Daml?
Key deletion for single element :
M.delete “ABC” dataMap
In similar to above what is the syntax to delete lets says “ABD” and “XYZ” keys from dataMap.
Hi @Sneha, you can chain multiple calls to delete
, e.g.,
M.delete "ABD" (M.delete "XYZ" dataMap)
If you have a list, you can use foldl
to delete all of them:
foldl (\acc key -> M.delete key acc) dataMap keysToDelete
This helps. Thank you @cocreature for quick response.