Representing null value for boolean in transforms


#1

I’m working on some types in c3 and having trouble when it comes to booleans. My source type field is a string, and the data from the source system comes in as ‘F’, ‘T’, or null. In my entity type the field is a boolean, and I’m having trouble with the transform logic. I would like to do something like this:

removedIndicator: ~ expression "REMOVED == 'T' ? true : REMOVED == 'F' ? false : null"

but it seems as though c3 will only allow true or false for a boolean. What might I do in this situation?


#2

via @rileysiebel

option

just load and store the string indicator (maybe even into a TimedValue in case it changes in the future) AND make a metric for “has the indicator been removed”


#4

via @rileysiebel

he could have a transform with a condition on it

@canonicalTransform(condition="exists(REMOVED)")
type TransformTheThingy {

  removedIndicator: ~ expression "REMOVED == 'T' ? true : REMOVED == 'F'"

}

in which case, if REMOVED didn’t have a value/null, the field removedIndicator would be empty