Skip to content

Null string values - decision needed #1183

Open
@kpodp0ra

Description

@kpodp0ra

Here is what I discovered

  1. Backend allows you to put empty strings as a text value
  2. Frontend changes them to null before sending API request
  3. Null values and empty strings are looking the same in UI
  4. There is a bug in aggregation:
    const flagString = `${currentGroupFieldId}_${groupByValueString}`;
    const groupId = String(string2Hash(flagString));

    Aggregation gives the empty string and the null string the same hash (see screenshot above where count is 4, not 2)
  5. isEmpty and isNotEmpty checks only for null values
    Resolution: fix: better match empty text fields #1181

Here is what ChatGPT thinks:

It's crucial to allow users to distinguish between empty strings and NULL values in databases because they represent different states with real-life implications. Here are key use cases where this distinction matters:

  • Contact Information: Empty strings mean the user explicitly chose not to provide data, while NULL signifies the data hasn't been addressed yet.
  • Survey Responses: Empty strings indicate a deliberate choice to leave a question blank, while NULL reflects that the question wasn't shown or interacted with.
  • E-Commerce: Sellers can indicate no product description is needed (empty string), while NULL flags pending updates.
  • Application Settings: Empty strings express "no preference," whereas NULL highlights unset configurations.
  • Medical Records: Empty strings confirm no allergies, while NULL signifies unknown allergy status.

My opinion

I know that implementing such a distinction may require some planning and work, but for me, it would be really useful if the null values would be shown as a dark dot or something like DataGrip has. This would allow me to distinct which values are empty on purpose and which are not yet filled.

Remember that you can hide fields in views, and these fields stay hidden in creation-modal. If one people in the company create records and others edit them, it is good to distinguish which fields have been populated.

Also, we have NULL and 0 values in number fields, why we don't implement this mechanic in strings?

I need feedback and decision what path we should go

If we want to keep null values and empty fields unambiguous, I would consider unifying the backend and frontend by changing the empty field to null on the server side.

But if we want to keep null values and empty fields separate, as LLM suggests, we should discuss if we want to and how to distinguish them visually in UI. JetBrains DataGrip does it like this:

We would also need some context-action to set NULL values:

Also, we would need NULL-button here:

And then there is the side issue of how we do with grouping. Should the null and empty string be treated by the aggregation as the same, or should we keep them in separate groups (as it is currently).

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurequestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions