Stream: dev

Topic: The boolean


view this post on Zulip Asbjørn Skødt (Nov 30 2023 at 23:17):

Hello!!!
As requested by Philip, I write here and continue conversation on issue: https://github.com/IQSS/dataverse/issues/7961#issuecomment-1834667463

Any files in the source code, I should look at to implement "the boolean", it sounds scary ;)

view this post on Zulip Oliver Bertuch (Dec 01 2023 at 06:17):

This is a commit for an old Version of Dataverse 4.20, but probably most of it is still true. Line numbers are probably not correct anymore. The validator has been updated since and the test might exist, so potentially ignore that part. Still, hopefully provides some pointers. https://jugit.fz-juelich.de/fdm/dev/dataverse/-/commit/d4aece03aebcf9c2237aa7842c17c0d96af6a79a

view this post on Zulip Philip Durbin 🚀 (Dec 01 2023 at 12:16):

@Asbjørn Skødt please take a look at the commit by @Oliver Bertuch above and let us know if you have any questions!

view this post on Zulip Asbjørn Skødt (Dec 05 2023 at 12:58):

Philip Durbin sagde:

Asbjørn Skødt please take a look at the commit by Oliver Bertuch above and let us know if you have any questions!

I will look at it and get back to you!

view this post on Zulip Asbjørn Skødt (Dec 18 2023 at 23:31):

Hello, is the name of the new datatype most appropriately "boolean" or "checkbox"?
"Boolean" is more true to the datatype in programming languages, however "checkbox" is more semantically meaningful in a website context and hence user-friendly.

view this post on Zulip Philip Durbin 🚀 (Dec 19 2023 at 00:14):

I'd go with "boolean". This is deep in the system and will also be accessed via API, where there are no checkboxes, just data. :grinning:

view this post on Zulip Asbjørn Skødt (Dec 19 2023 at 00:23):

Thx!!!

view this post on Zulip Asbjørn Skødt (Dec 19 2023 at 03:42):

How should no value (null) be handled?

  1. convert null to default value "false" (however, what if you want default to be true?)
  2. value is invalid and reports validation error

view this post on Zulip Asbjørn Skødt (Dec 19 2023 at 03:43):

  1. as a user i don't want to provide an answer (value), so null should stay null

view this post on Zulip Philip Durbin 🚀 (Dec 19 2023 at 13:10):

Hmm. Good question. In Java there's the idea of "optional" in order to avoid nulls. Maybe we could use that pattern?

view this post on Zulip Philip Durbin 🚀 (Dec 19 2023 at 13:10):

But yeah, I think in most people minds there are actually three values: true, false, or unspecified. :thinking:

view this post on Zulip Philip Durbin 🚀 (Dec 19 2023 at 14:12):

I mean, should we consider having two new data types: a true boolean vs. a nullable boolean?

view this post on Zulip Philip Durbin 🚀 (Apr 10 2024 at 20:56):

@Asbjørn Skødt don't look now! A new PR! Custom metadata support boolean values #10480

view this post on Zulip Philip Durbin 🚀 (Apr 10 2024 at 20:57):

Do you want to QA it for us? Or at least review it? :grinning:

view this post on Zulip Jérôme Roucou (Apr 11 2024 at 08:11):

Hi. If you have any questions about the PR I can answer them here or directly into it.

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 11:39):

@Jérôme Roucou for the UI, it's a text input. Did you consider any alternatives such as radio buttons or a drop down? Something where you don't have to type? :grinning:

view this post on Zulip Oliver Bertuch (Apr 11 2024 at 11:41):

Checkbox?

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 11:45):

Or a checkbox, sure.

view this post on Zulip Jérôme Roucou (Apr 11 2024 at 12:13):

I'd considered a checkbox too, but not being sure about the original need. So I left a simple input text field. But a checkbox can only be true or false, not null.

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 12:48):

Well, @Asbjørn Skødt has an actual need. Maybe he can enlighten us.

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 12:48):

Or maybe I can remember what it was. :thinking:

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 12:51):

Interesting. scripts/api/data/metadatablocks/custom_hbgdki.tsv has a dropdown:

2c50f3a8-83d1-11e5-8ae1-85d1599278fd.png

From this issue (which I closed in favor of #7961): Metadata: Support radio buttons for Yes / No responses #2727

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 12:56):

I just encouraged the community to take a look at the PR and this Zulip thread: https://groups.google.com/g/dataverse-community/c/9-T3jtd03tY/m/294KXvwaAQAJ

view this post on Zulip Jérôme Roucou (Apr 11 2024 at 13:01):

Oh thanks ! :pray: On this conversation dropdown seems to be appreciated

view this post on Zulip Oliver Bertuch (Apr 11 2024 at 13:01):

http://www.primefaces.org/showcase/ui/input/triStateCheckbox.xhtml?jfwid=b8c01

view this post on Zulip Oliver Bertuch (Apr 11 2024 at 13:03):

Also available in React: https://dev.to/gsto/how-to-build-an-indeterminate-checkbox-in-react-kbh

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 13:06):

@Ellen K @Guillermo Portas any opinions on how a boolean input should look in React?

view this post on Zulip Ellen K (Apr 11 2024 at 13:13):

We have been using React Bootstrap for our basic input components (wrapping them in our design system) so I would try that first. They have a component here that we could look at https://react-bootstrap.netlify.app/docs/forms/checks-radios/

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 13:13):

Perfect. Thanks, Ellen!

view this post on Zulip Oliver Bertuch (Apr 11 2024 at 13:18):

Would this help @Ellen K ? https://stackoverflow.com/a/70434396

view this post on Zulip Ellen K (Apr 11 2024 at 13:26):

If we want to represent a boolean that is optional, and record the difference between 'false' and null then I think a simple 2 button radio will work, right? So I don't think we need to have an a customized checkbox, unless I'm missing something

view this post on Zulip Asbjørn Skødt (Apr 11 2024 at 14:40):

This is great!!!
Yes, for sure I want to help out. I'll take a look.

If curious, this is some code I wrote on the issue some months back, but never got around to fully deal with the nullable dilemma: https://github.com/IQSS/dataverse/commit/0862bcc4aafcb58120d4e4847626c2a7e359f804
I suggest we leave this code behind and continue focus on Jerome's PR. If I am late to responding in the future, please do not delay any QA or review on my behalf.

With regards to UI implementation, I think it should either be a dropdown or radio button approach, in order to deal with the nullability dilemma. A checkbox can, unfortunately, not properly deal with nullability (or rather a false statement), and a checkbox cannot be required.

The dropdown/radio buttons may have three value options which in the backend would equate to "True", "False" and "Null". In the UI these may be written as "Yes", "No" and "Blank" or left customizable by the metadatablock.

These are my thoughts atm. What do you think?

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 14:44):

I think I said this in Mexico but we could have two types, if we need them:

But I don't know if we need both. :grinning:

view this post on Zulip Oliver Bertuch (Apr 11 2024 at 14:53):

non-nullable bool is the same as required nullable bool

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 15:18):

For nonNullableBoolean (requiredNullableBoolean) there should be a default value.

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 15:21):

I remember @Asbjørn Skødt 's use case: The question was "Should this dataset be archived in our archival system?" And the default value should be false.

view this post on Zulip Oliver Bertuch (Apr 11 2024 at 15:29):

There was an issue about having default values as part of the TSV, aye?

view this post on Zulip Oliver Bertuch (Apr 11 2024 at 15:29):

I'd say go for that and don't imply an implicit default, just specify it in the field

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 15:38):

We just talked about this a bit in the frontend meeting. @Gustavo Durand pointed out that one way to set default values is with dataset templates.

view this post on Zulip Philip Durbin 🚀 (Apr 11 2024 at 15:39):

But yeah, maybe it should be possible to specify a default value in the tsv.


Last updated: Nov 01 2025 at 14:11 UTC