Validation of numeric values

Hi there,

So - for numeric values Coda only accepts “.” as a decimal separator. I’m from a part of the world (Denmark) where we use “,” as a decimal separator and “.” as a thousand separator.

How do I prevent users from entering “,” as a decimal separator for numeric values? Coda accepts whatever I input. It does, however, highlight the cell - but a user could potentially miss this. Also aggregate functions won’t work if there’s a non numeric value in a given cell.

Any suggestions would be greatly appreciated, thank you.

I hear you, I am from Belgium; there is no solution yet and I am not even sure if they have a road map that contains this subject.

I import on a regular basis local data and data contains a comma. I use a button to ModifyRows() and replace the comma with a a dot. It is not ideal, but it works.

Cheers, Christiaan

3 Likes

@Christiaan_Huizer
Ha a Belgian here :), I feel less alone now.
But indeed, the only way is to add in your number column a formula that replaces according to your preferences.

2 Likes

There are some hacks you can use. None of them are ideals but it may work for your case.

  1. You can “sweep the dirt under the rug”:

You would create a hidden column with a formula like this If(RegexMatch(ThisRow.ValueColumn, ",", RegexReplace( ThisRow.ValueColumn, "," , "." ), ThisRow.ValueColumn)
Then you use the hidden column for all the calculation

  1. You can create an automation to validate the date.
Table
  .FormulaMap(
    SwitchIf(
      Value.IsNumber().Not(),
      Notify(
        User, Format("{1} has an invalid data", CurrentValue)
      )
    )
  )
  1. You can force the user to press a button every time he enters data. You can disable the button if the data is not validated.
3 Likes

Hey All - (and @Nick_HE , @Eric_Koleda )

Could we now make a pack as a column format that would allow you to input numbers with a “.” As the thousand separator?

I haven’t dived into that part of packs yet so hoping Eric or Nick can shine some light. If we could, this would solve a huge problem for many

5 Likes

Oh true ya, that should work.

I’m not super familiar with how Coda currently handles numbers with commas. I guess 23,45 is treated as a string but 1.000 is treated as an integer, 1?

In theory if your column type formula took a string as input, Coda should interpret 1.000 as a string, and then we could convert it to the number 1000 in the Pack.

I guess this would just work for ingesting number format strings of 1.234,56, and returning numbers (1234.56). You wouldn’t want it to go the other way (display the number 1234.56 as 1.234,56, because we would have to return the 1.234,56 as a string and you wouldn’t be able to then do math with it).

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.