- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2014 11:14 AM
I have a data set with True/False data types. When i export the data from the other system the values are either t or f . not True / False or 1/0. When I import the data SNow does not recognize that i na True/False field t is true and f is false. Is there any way to import the values as-is and have the transform understand that if I am entering into a true/false data type that t is true and f is false. I dont want to change all the values in the import because there are a lot of fields and hundreds of thousnads of rows.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2014 11:37 AM
A before script would definitely work, however I would suggest editing the field map with a script because that way you have all the logic together at the field map level. Open your existing field map for the true false field and then check the Use source script box and paste in the following:
if (source.field == "t" || source.field == "1") {
answer = true;
if (source.field == "f" || source.field == "0") {
answer = false;
These scripts need to have answer="ANSWER", but otherwise they are like any other scripts.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2014 11:29 AM
Use data source + transform map. Add a onbefore transform script and use something like this
if(source.field == 't')
{
target.field = true;
}
else
{
target.field = false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2014 11:37 AM
A before script would definitely work, however I would suggest editing the field map with a script because that way you have all the logic together at the field map level. Open your existing field map for the true false field and then check the Use source script box and paste in the following:
if (source.field == "t" || source.field == "1") {
answer = true;
if (source.field == "f" || source.field == "0") {
answer = false;
These scripts need to have answer="ANSWER", but otherwise they are like any other scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2014 01:29 PM
Michael,
This did work, although I have about 45 T/F fields, this would need to be placed inside each one, and every transform map (i have a few other tables to load with boolean data in the same format)? Is there a quicker way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2014 01:53 PM
Unfortunately no. As Kalai suggests, tou can either do this with a script in the transform map, before script, or field map script. But each requires you to specify the source field so you are repeating this X times.