Why Transform Script is not working as expected

Atik2 Bagwan
Tera Contributor

I have an Import set via which I am trying to import the data into the alm_asset table, where I need to check that the Model Category is one of Computer, Printers, and Monitors.

So, for that, I have written the On Before script and checked if not one of them then logging an error but It is not working as expected even though I am trying with the model category as the computer is still throwing an error

 

I have written the below code

 

var modelCategory = String(source.u_model_category);

if (JSUtil.nil(modelCategory) || modelCategory != 'Computer' ||
modelCategory != 'Monitor' || modelCategory != 'Printers') {
log.error('The Model Category should be specified as either Computer, Monitor, or Printers.');
ignore = true;
}
 
Please Can anyone help me with this?
 
Thanks,
Atik

 

1 REPLY 1

Najmuddin Mohd
Mega Sage

HI @Atik2 Bagwan ,
Can you check once by including modelCategory in the log, to actually validate what is being stored in the modelCategory field when you are importing data with model category as computer.

If this information helps, please mark this post as helpful!

Regards,
Najmuddin.