What is the best way of creating a boolean column based on an integer column?
AnsweredHi Folks, what is the best way in a workbook of creating a boolean column based on an integer column. If I was to pseudo code it, it would be as follows:
OPEN CODE
if("#_CrashData2010!NUMBER_OF_PERSONS_INJURED">0)
{
"#_CrashData2010!K" = true;
}
elseif("#_CrashData2010!NUMBER_OF_PERSONS_INJURED"==0)
{
"#_CrashData2010!K" = false;
}
END CODE
Thanks in advance for your insights... I'm looking to have an extra boolan column based on an integer column returning the number of folks injured.
-
Hello John,
Depending on your input data set and the values available you will have different possibilities.
For a data set without negative or null values
=IF(GT(#CrashData2010!NUMBEROFPERSONSINJURED;0); true; false)
For a data set which might contain negative or null values it could be helpful to have an additional clearing rule.
=IF(GT(#CrashData2010!NUMBEROFPERSONSINJURED;0); true; (IF(EQUALS(#CrashData2010!NUMBEROFPERSONSINJURED;0); false; null)))
Will this work in the way you like?
-
Hi, thanks for the formula dude.. it crashed the sheet with on both occassions with Sheet contains errors.
Sheet 'CrashData2010' referenced in 'ProcDataSheet' does not exist in: [NYC_NYPD_CrashData2010, ProcDataSheet, ClusteringSheet1, artifactsheet_4c901ed4ade6440c9b0f19393b6faf8f, artifactsheet_3d1dfd8c1b594ac687308ad385d74453, artifactsheet_04095a6b0a374f19bd7c16ebcfa347a8, artifactsheet_f15a7ed2b1634cef97792bc7b55b5c8c].Any further insights on getting a boolean would be most appreciated... Thanks bro!!..
-
Hello John,
Right, there is also a command Less Then, called LT (https://documentation.datameer.com/documentation/current/LT). You can find all available functions listed in https://documentation.datameer.com/documentation/current/Datameer+Functions.
Please sign in to leave a comment.
Comments
7 comments