P-bibs / codap-transformers

A plugin for CODAP that enables data transformations like map, filter, and fold
https://codap.concord.org/app/static/dg/en/cert/index.html?di=https://laughing-dijkstra-115d3c.netlify.app/
MIT License
3 stars 2 forks source link

Booleans in CODAP #248

Open retabak opened 2 years ago

retabak commented 2 years ago

So, I'm suspecting this is a CODAP issue and not a Transformers issue but I'm not sure, so....

The original Animals Dataset spreadsheet always had TRUE and FALSE in all caps.

CODAP didn't seem to like that, so I updated the spreadsheet with true and false in lowercase.

The funny thing is, when I use true and false in expressions (for the Transformers), I still need to enter them as strings - in quotation marks. Otherwise, I get weird results. (For example, if I enter fixed = true, I get back an empty dataset. The Transformer works just fine with fixed = "true", though.)

any idea what's going on? I assume this is not in our control.

thomascastleman commented 2 years ago

That's correct, I believe this is behavior stemming from CODAP not parsing booleans correctly when it imports a sheet. They are left as strings, which is why you're seeing the filter work with "true" but not true. I believe they recognize this as a bug and intend to fix it but I'm not sure what progress has been made.

retabak commented 2 years ago

Hm...

Is there a way to tell the spreadsheet once it's already imported to CODAP that all those trues and falses are booleans?

Or if I were to just go ahead and make the spreadsheet in CODAP, could I get it to understand that true and false are booleans, not strings?

If I had to guess, the way to do this would be (1) click on column name, (2) select attribute properties, (3) go to "type", and (4) select boolean! But unfortunately boolean is not an option in the drop-down menu that appears.

image