-
-
Notifications
You must be signed in to change notification settings - Fork 501
Fix/numeric default none #1533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix/numeric default none #1533
Conversation
|
I think making that the new default could be disruptive to those with existing documents. New rows will suddenly behave differently from how they used to behave. Also, there are certainly some cases where 0 is the better default, and it's hard to know which is more common -- for those users for whom 0 is better, there will be new a annoyance in having to create What do you think of instead making it easier to toggle the preferred default, so that it can be done with a click rather than with typing in a formula? One other idea is to introduce a new type, so that there is both |
|
(examples are in Grist 1.4.2)
That is true, input behavior would change. Looking at calculations though, it seems to me the disruption is contained by the way upper-case functions ignore e.g. data: IMHO, since B4 & B5 did not receive my user input, the average is wronged by default-0, and the right behavior is C. Obviously in such a small table, the automatic-0 values are easily seen & fixed, but what about 15-col/100-row docs? No way a 0 in the middle easily be spotted (happened to me twice already). For standard ("lowercase") Python, default-0 already today does not avoid type issues : Requiring Matter of fact, the docs are already recommending
That is true. From a user perspective, I would say:
The only value that is neutral to any downstream to me seems to
Why not, but then we need multiple buttons, I see at least
Agree. Plus they would basically be the same type in backends, because both would support deliberate |
|
So, the behavior is of course different between 0 and
I feel that at least for the last question, we shouldn't change the default value. I.e. existing columns in existing documents should still default to 0 (new rows will get 0 values), to reduce disruption. For other questions, the risk of disruption from switching the default is lower, but there is still a tradeoff. |
|
I highly agree on the matter with @raph-topo, that Indeed, I want to differentiate between a value that has been manually registered/validated, and a value that has not been reviewed. I prefer an error raised because a formula required a number and got None, than a silent erroneous calculation. So I'm always setting back value to None manually when I'm setting up numeric columns, and I don't recall an occurrence where I wanted zero to be the default value (once, I wanted 1 to be the default value, for quantities of items). |
I would say why not. Even if I'm quite fine with trigger formulas, having some preset defaults (in sync with init formula) may be a plus (if that does not make the interface looks too cluttered), especially for less tech-savvy users. It would both slightly reduce the time needed to configure columns, and give some ideas about (as does the "Shortcuts" option in the column creation menu). If we think about what kind of default values would be interesting to have, I can think of:
I don't know if it's worth it to add the functionalities for such options, but it may constitute a friendlier way to introduce user to trigger formulas. And it may also be the opportunity to think about better communicating about some special object interesting to use in trigger formulas, like the |
It makes sense (even if, as far as I'm concerned, I would be happy for all my columns to be changed to defaulting to None, if I didn't make them do so myself already). A way I see for doing this would be to set trigger formulas to |





Context
In columns of type Numeric (
float) & Integer (int), a new row gets populated with value0.But
0is a valid value, and actually neither more nor less valid than any other float or int. Reason for the existence ofNonein Python.0really means "cell has been defined with value 0" and not "no numeric value defined yet". A new numeric cell should thus be empty (None) by default.As such I find myself creating trigger formulas for every numeric column
=None.Proposed solution
Set Python
None& JSnull& SQlite"NULL"as default for Numeric & Integer columns.Related issues
#1530
Has this been tested?
Some functions now require the following to coalesce
Noneto0for calculations:Maybe this is not what you want? It feels more robust though (i.e. end user has to make sure his data is type-safe everywhere and not rely on silent old-default behaviour).
WIP: some tests still to fix.