locked
How to sort group by number if the field is string? RRS feed

  • Question

  • User-251496785 posted

    I have a field that represents apartment number and it is string. When I have a group sorted by that field, I get:
    1
    11
    12
    2
    etc..
    I want it to go is it would if it were a number..
    1
    2...etc
    I have tried to create a sort formula:

    if isnumeric({table.field}) then ToNumber({table.field})  else -1

    But that is not working..
    I mean it is working, but the numbers are like this:
    1,00
    2,00..
    Can someone help?  I tried to put ToText, but then it gives me an error

    Monday, March 19, 2018 7:26 PM

Answers

  • User516094431 posted

    As per your question can you try following code:

    If NumericText ({table.field}) Then
          ToNumber ({table.field})
    Else
         -1;

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 26, 2018 11:30 AM