Transform map not setting boolean from Y/N field

Chuck Tomasi
Tera Patron

I've got an issue with my nightly employee import. My HR database has a field called "ITAR_AUTH" that has a value of "Y" or "N". I use a script like this:



// Map the US Citizen flag from ITAR field
if (source.u_itar_auth == 'Y') {
target.us_citizen = true;
} else {
target.us_citizen = false;
}

to set our field "US Citizen" (u_us_citizen) to true/false. It's not working for some reason. The logic seems simple enough, but when I check my record in the SQL database, I see ITAR_AUTH is "Y", but my sys_user.u_us_citizen is false. As a test, I mapped itar_auth to middle_name and it pulled in all the "Y" and "N" values, so why wouldn't my condition above work? I know I could probably shorten this up to


target.us_citizen = (source.u_itar_auth == 'Y' : true : false);

But I thought I would keep it readable until I verify it is working.

3 REPLIES 3

Chuck Tomasi
Tera Patron

Sorry, I think that should be



target.u_us_citizen = (source.u_itar_auth == 'Y' ? true : false);


I think I found it... typing it that last line seems to have tripped my memory... Looking at the script, the value I have is target.us_citizen, should be target.u_us_citizen. Trying an import now...


That was it. I was missing the u_ for my user defined field. Gee, that's never happened before.