0

Changing ID numbers

Hi,

I'm new to Ninox.  I want to add new records, but I don't want them to go to the default at the end, I'd like to be able to insert them in between current data and have the ID numbers adjust themselves.  Is there a way to do this?

8 replies

null
    • Sean
    • 4 yrs ago
    • Reported - view

    You would have to create your own "Id" field and and then update the numbers when you insert a new record. This Id field is basically a ranking field and you would sort the records on this field. There is a database named "Rank" that demonstrates how you can do this on Ninox's Webinar EN 2019 page.

    • computers
    • 4 yrs ago
    • Reported - view

    Thanks for the response, but I'm still a little confussed.  I understand how to sort the records from a particular field, however I can't find an 'autonumber' field, only a number.  That means I would have to type the number in and then change them if I put a new record in?  That is a lot of work when there's over 1000 records...

    I want to keep my list in alphabetical order according to name, but not have street numbers effect the alphabetical order.  It's for an architectural project list where some projects have a name like 'Victorian Arts Centre' and others like '11 Victor Street', where I want these records to appear next to (or after) each other.

    Seems there should be a nice easy way for me to keep my list in this way - but can't seem to work it out!

    Thanks for your time, much appreciated!

    • Choices_Software_Dean
    • 4 yrs ago
    • Reported - view

    You could create a new column with values of 1.000, 2.000, 3.000, etc. Then when you insert, split the difference. For example, to insert between 1.000 and 2.000, enter 1.500. To insert between 1.500 and 2.000, use 1.750. Then sort on that column.

    • Choices_Software_Dean
    • 4 yrs ago
    • Reported - view

    This question reminds me of accounting software that I bought years ago where the customer id was based on the first three letters of the customer's name, followed by a period and three digits. Same concept.

    • Sean
    • 4 yrs ago
    • Reported - view

    @Westy, Excellent solution... I did a mental facepalm when I read it!

     

    @computers@rbaarchitects.com.au, You can fill the number field of existing records using code like this in a button or through the Console...

     

    let myNum := 1;
    for i in (select YourTable) order by ProjectName do
    i.(YourField := myNum);
    myNum := myNum + 1
    end

    • computers
    • 4 yrs ago
    • Reported - view

    Thanks for your responses.  I'll guess I'll have to try this method @Westy!  @Sean, where abouts do I post the ode for this to occur?  ...New to Ninox and not sure where the coding should go.

     

    once again, thanks for the help.

    • Sean
    • 4 yrs ago
    • Reported - view

    You can add a button to your form and enter the code in the "On click" section of the button. Once the records are updated you can just delete the button.

    • computers
    • 4 yrs ago
    • Reported - view

    Fantastic, thanks again for the help!

Content aside

  • 4 yrs agoLast active
  • 8Replies
  • 2418Views