Without knowing NetSuite's underlying schema, it i...
# suitescript
s
Without knowing NetSuite's underlying schema, it is likely that the boolean/checkbox fields are all really CHAR(1) fields that actually store 'T' or 'F' in them. Historically, Oracle databases did not have a BIT data type, so this is a common pattern for persisting booleans ( alternatively, 'Y' and 'N', or even '0' and '1'). My guess is that SuiteScript 2.0 simple wraps some results in a method to convert those values to booleans. You could implement your own wrapper function, too, with something like:
function getAsBoolean(value) { return util.isBoolean(value) ? value : (value === 'T' ? true : false); }
. I haven't tested that, but something like that should work. As for why returning the search works that way, it may be because the results passed back to the M/R script are not filtered through whatever SS 2.0 functions convert the string values to booleans, and are closer to the actual database stored values. This is all purely speculation, but I have noticed the same inconsistency. I worked in a Java / Oracle environment for 6 years, and we had a wrapper class for Hibernate to convert 'Y' and 'N' to Boolean on retrieval using similar logic, but occasionally people used direct SQL queries, and then had to deal with the raw results, which were single character strings.
👍🏻 4
s
NFT-SS1 did just that for booleans🙂