Compare and convert to new item

Hello, I need to compare the field column, if it is 1 it is equal to “instagram_user”:“column value” and if it is equal to 132 it is equal to “data”:“column value”, is it possible to do this on the n8n?

Hi @htnrodrigues, this should be doable with n8n. Are you looking to simply replace the current value in your field field?

If so, this example should get the job done:

This example uses the switch statement in order to check for the different field values. This is the result it would return:

If you’d rather have this result in a new field simply change $input.item.json.field in line 3 and 8 of the example code to something like $input.item.json.yourNewFieldName.

Hope this helps!

1 Like