- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2022 10:44 AM
Hi All,
We have a transform map where we need to import data from excel to a table. There is one column in the excel which has values either 'TRUE' or empty value. We need to map this to a field which id boolean type. Could you please let me know where there is error in the below script:
answer = (function transformEntry(source) {
// Add your code here
//return ""; // return the value to be put into the target field
if (source.u_disabled == "true" || source.u_disabled== "TRUE") {
answer = true;
}
if (source.u_disabled == "" || source.u_disabled == "FALSE") {
answer = false;
}
})(source);
Thank you
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2022 01:19 PM
Hi indra,
Try the following script;
answer = (function transformEntry(source) {
// Add your code here
if (source.u_disabled == "true" || source.u_disabled== "TRUE")
return true; // return the value to be put into the target field
else if (source.u_disabled == "" || source.u_disabled == "FALSE")
return false; // return the value to be put into the target field
})(source);
Hopefully this will work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2022 11:26 AM
Hi Indira, Please make sure the column name is correct and also include log statements to print the output and check if the If loop is getting executed or not. Also, assume you are using the main transform script field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2022 01:19 PM
Hi indra,
Try the following script;
answer = (function transformEntry(source) {
// Add your code here
if (source.u_disabled == "true" || source.u_disabled== "TRUE")
return true; // return the value to be put into the target field
else if (source.u_disabled == "" || source.u_disabled == "FALSE")
return false; // return the value to be put into the target field
})(source);
Hopefully this will work.