0

display numbers in ascending order that are in a text field ?

Hi,

 Is there a way to display numbers in ascending order that are in a text field ?

Otherwise how can I copy quickly numbers that are in text fields into number fields ?

Thanks

23 replies

null
    • Fred
    • 3 yrs ago
    • Reported - view

    If there is no text in the field you can create a new formula field called conv_TextField and have it set to number(TextField). That will convert the old text field into a number.

    • Mel_Charles
    • 3 yrs ago
    • Reported - view

    Alternatively

    If you have already filled that field in many records and you decide to create a new number field

    You could then add a button and insert this code to copy the contents of text field to the number field in all records

    then once copied delete the first text field

    TAB1 = your table name

    TF1 = your text field name

    NF1 = your Number field you create

    for i in (select your TAB)[TF1 > " " and NF1 = null] do
    let a := i.TF1;
    i.(NF1 := a)
    end

    Mel

    • Mel_Charles
    • 3 yrs ago
    • Reported - view

    oops tht should read

    for i in (select TAB)[TF1 > " " and NF1 = null] do
    let a := i.TF1;
    i.(NF1 := a)
    end

    Mel

    • saddinsell
    • 3 yrs ago
    • Reported - view

    Thanks Fred, thanks Mel.

     Hi Fred,

    about the function conv_TextField where do I find it ?

     And I don’t understand how that function could change the numbers of the other field text where my numbers are typed.

    Hi Mel,

    did you change the part of the function : I do not see the difference…

    • Fred
    • 3 yrs ago
    • Reported - view

    conv_TextField is not a function it is just the name of the new field that you then type in number("name of field") in the formula. You can call the field whatever you want that makes sense to you.

    • saddinsell
    • 3 yrs ago
    • Reported - view

    Thankd Fred.

    I called the field conv_TextField 

    but Sorry but I do not undestand what to do after…612BA1A9-EA9F-452A-A480-64316E62D707

    • Fred
    • 3 yrs ago
    • Reported - view

    Sorry for not being very clear.

     

    You can delete this field and create a new formula field with the same name. The in the formula put in number("name of field").

    • saddinsell
    • 3 yrs ago
    • Reported - view

    Thanks.

     Ok but you still do not explain what to do after having named the field.

    (Sorry I am not very gifted in this kind of thing…)

    • Fred
    • 3 yrs ago
    • Reported - view

    Sorry, I used the wrong spelling. We are creating a Formule field.

     

    Name it whatever you want

    In the formula of the field put number("name of field").

    • saddinsell
    • 3 yrs ago
    • Reported - view

    Thank you.

    Sorry I do not succeed.A19415C4-9FFF-477C-8F17-5AA7C07B30BF

    • saddinsell
    • 3 yrs ago
    • Reported - view

    2B5B38C0-E083-4B07-BB9A-FD0F3AF97A4D

    • Fred
    • 3 yrs ago
    • Reported - view

    Hi there -

     

    What you are showing me is the database sorting properly. What trips everyone up is that 1 and 10 are sorted first then 2 and 20 and 200 or 2000. They all start with 2.

    You need to add a 0 in front of the single digit numbers then they will sort first.

    Something like:

    if "nombre de espèces" < 10 then

    0 + "nombre de espèces"

    else

    "nombre de espèces"

    end

    • saddinsell
    • 3 yrs ago
    • Reported - view

    But the field with the function I create is full of 0 !

    You speak about the old txt field !

    • Fred
    • 3 yrs ago
    • Reported - view

    My mistake.

    That is weird. I just did it in my DB on a text field that has numbers and it shows up fine.

    I noticed that in your formula Nombre has a lower case N, but your field name has an upper case N. Does that make a difference?

    • saddinsell
    • 3 yrs ago
    • Reported - view

    I tried with N unstead of n : same issue > 0 everywhere…

    • Fred
    • 3 yrs ago
    • Reported - view

    Well that has stumped me. I'm guessing that there is only numbers in the Nombre d'Espèces, so I don't know why it formula field is showing up as 0. Maybe someone else can shine some light on this.

    Or you can do Mel's suggestion.

    • saddinsell
    • 3 yrs ago
    • Reported - view

    Ok.

    Previously, on the start of the discussion you talked about ”conv_TextField»

    Could it be the key of this mystery ?

    conv_TextField unstead of number (”“) ?

    • Ninox partner
    • RoSoft_Steven.1
    • 3 yrs ago
    • Reported - view
    • Ninox partner
    • RoSoft_Steven.1
    • 3 yrs ago
    • Reported - view
    • Mel_Charles
    • 3 yrs ago
    • Reported - view

    In my first script I left your in - as i started to type your table name here !!! this should not be there

     

    for i in (select your

    • saddinsell
    • 3 yrs ago
    • Reported - view

    Hi Steven, thank you.

     CAED20DC-0157-4142-B6D8-1CF01CDC95F0I get this error :

    "A column has not been find :Nombre d’espèces on the line 1, column 33"

    • Ninox partner
    • RoSoft_Steven.1
    • 3 yrs ago
    • Reported - view

    I think the quotation marks (guillemets) are of the wrong type in the fieldname. Maybe it's better to click on the fieldname like:

    Addinsell5

    Steven

    • saddinsell
    • 3 yrs ago
    • Reported - view

    Great ! Well done !

    It works perfectly.

    Thanks again, Steven.

Content aside

  • 3 yrs agoLast active
  • 23Replies
  • 1415Views