arraycontains in if condition in column expression node

Hello All,

From the below table, i am trying to change the incorrect location highlighted in Italic based on the criteria given.

Region Country Location
Asia India Godavari
Asia India Arunachal
Asia India Assam
Asia India Bihar
Asia India Chhattisgarh
Asia Nepal Biratnagar
Asia Nepal Janakpur
Asia Nepal Hetauda
Asia Nepal Pokhara
Asia Nepal Butwal

if the Region is Asia and Country is India and location is array of India’s location
then what ever the value of location for that row
else “Andhra”.

I tried with column expression node to apply the above criteria, but got error.

I searched in forum for related topics, couldn’t found one. Googled it how to apply arraycontains in if condition in java, but no luck.

Below is the screen shot of the node.

Could someone assist on this.

example.xlsx (8.3 KB)

Location is not an array but just string. Use string manipulation functions to get what you need. Say looking for space or coma separating locations names.

Hi @izaychik63, since it has multiple conditions with different columns, i don’t think string manipulation is suitable, as it supports only single column changes, correct me if i am wrong.

Regards,
Pavan.

Hi there @pawanmtm,

arrayContains() function can not be used like that cause first argument is array. So first create an array. Something like this:

Also you can use Rule Engine node to apply same logic:

As you have multiple Regions and Countries you will have to expand/modify above examples. Maybe you can try Rule Engine (Dictionary) node for this use case :wink:

Br,
Ivan

3 Likes

Hi Ivan,

Thanks for your helping hand.

I first thought of Rule Engine node, but didn’t quite get right, hence used column expression.

The 2nd line in the rule engine that you have written, does that work as else statement? What i mean to ask is, if the 1st line is false, does it go to 2nd line to check the condition?

This is to ensure to put effective mechanism in place.

Regards,
Pavan.

Hi Pavan,

it works as you described it. For complete logic take a look at node description :wink:

Br,
Ivan

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.