How many states does a Boolean have?

Forum rules

No spam or trolling allowed -- please keep topics and posts respectful.

Posted on
Wed Aug 23, 2017 4:57 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

How many states does a Boolean have?

This is nothing to do with Indigo which is why I've put it here.

At work (UK secondary school; ages 11-18) I just imported our new students and parents into the central system.

In it, there is a required Boolean field. "Court order". The UI allows you to tick or untick it, fair enough. If the Law Courts have decreed a parent shall have no access to their child, they get ticked.

When reporting on this field, you can choose to filter on it. "When court order is...." True or False. Fair enough.

So why when I run a report to show the values in this field, do I get "T", "F" and "" ???!!!?? It's a Required Boolean field so "" is physically not a valid value!

The report governs access to our online parent portal and filters on "Court Order = False", which thus returns no parents because the whole year group are "" but I can't filter on that because the UI won't let me.

Grrrr!


Sent from my iPhone using Tapatalk Pro

Posted on
Wed Aug 23, 2017 5:10 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: How many states does a Boolean have?

It's likely a backend system issue - likely because of a database construction problem. It may be that their backend database doesn't support a boolean field type, in which case they may have implemented the field as a character field. But, they didn't create a default value in the db so when you did the import there wasn't a value added for that field.

Annoying, and somewhat sloppy backend work, but unfortunately not very surprising.

There is a similar problem with Django - if you want a field to be nullable, you can specify that the field can be null. Unfortunately, in the built-in administration screens, there is no way to set a field to "null" - you can only clear the field which represents and empty string "" which is not equal to null. So if you use the admin screens basically you have to specify that the field is not only nullable but also can be blank. Which adds yet another possible option. Fortunately, you can easily override the save method for the model to look at fields and any you don't want to be blank (empty string) you can set to null before the save occurs. Still, it's a PITA.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Wed Aug 23, 2017 9:25 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: How many states does a Boolean have?

The report governs access to our online parent portal and filters on "Court Order = False", which thus returns no parents because the whole year group are "" but I can't filter on that because the UI won't let me.

Any chance your filter will allow turning that around for the value? For instance, if you want "" and False to be equivalent, go for CourtOrder != True.

Posted on
Thu Aug 24, 2017 12:05 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: How many states does a Boolean have?

I should maybe have mentioned that this software costs £25,000 and is used by ~80% of schools in the UK to run the school. (Staff, students, parents, attendance, timetables, behaviour, exams, assessment, first aid, the whole lot!)

Rogue, that's an interesting thought - I don't think you can or I'd hope I'd have thought of it - but I will certainly have a look.

We have another piece of software which is authorised, through a partner API, to write into the database - ive already emailed them to see about updating any "" to F in that field for me.


Sent from my iPhone using Tapatalk Pro

Posted on
Thu Aug 24, 2017 10:19 pm
akimball offline
Posts: 559
Joined: Aug 07, 2013
Location: Sandy, Utah

Re: How many states does a Boolean have?

I once believed that booleans had only 2 states, say 0 or 1. You seem to have the added state of the 'null set' which is valid only for variables not yet initialized. Also, I became acquainted with the issues in math solved by considering imaginary numbers, where i = sqrt(-1).... which is very useful for keeping logs and exponentials from blowing up, but still does little to save the lowly issue of division by zero, which introduces states effectively dragging positive and negative infinity into play; approximated inversely by a Riemann sphere however in the strango-chango universe which says that -infinity and +infinity can actually meet in the middle...leaping over computer issues which cause even division by zero to seem doable.

And so we now have the set {1, 0, '', i, -inf, +inf} as possible boolean states. Which leads me to execute my primary sterilization function and self destruct. Good luck.

-Al

Posted on
Fri Aug 25, 2017 1:31 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: How many states does a Boolean have?

RogueProeliator wrote:
The report governs access to our online parent portal and filters on "Court Order = False", which thus returns no parents because the whole year group are "" but I can't filter on that because the UI won't let me.

Any chance your filter will allow turning that around for the value? For instance, if you want "" and False to be equivalent, go for CourtOrder != True.

I can't do that - there's no "is not =" evaluation in the UI.

BUT - there is "Is Null" and "Is Not Null" - so I can OR them together to make "Is False or Is Null".

Thanks for promoting me to think it through!


Sent from my iPhone using Tapatalk Pro

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest