Day 3 : Batchmode in impex

Priyanka Manikkoth
1 min readNov 7, 2021

--

Another question I screwed up in interviews. I have used batchmode=true multiple times while deleting itemtypes. But haven’t thought it through how it behaves. On most days, I sleep walk through my day. If I had paid even a slight bit of attention, I could have answered this question easily. :(

So why do we use batchmode in impex?

As the name itself suggests, batchmode is used for handling data as a batch.

If explicitly not given, batchmode is always false. In the normal scenarios if our impex unique attribute resolves more than one record, we would get error like multiple records found for update and cannot be updated.

Batchmode is useful when we want to update multiple rows of an itemtype. Usually I clear off some item types using the typecode.

$targetType=Reference
REMOVE $targetType[batchmode=true];itemtype(code)[unique=true]
;$targetType

For updating all the customers with marketingEmail as true

UPDATE Customer[batchmode=true];itemType(code)[unique=true];marketingEmail

;Customer;true

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Priyanka Manikkoth
Priyanka Manikkoth

Written by Priyanka Manikkoth

Coder by occupation, dreamer by choice

No responses yet

Write a response