How to generate number in sequence using MySql

I am making details of order app in which I want that number will automatically generate (sequence wise starting from from ) and the next number should be +1 from last recorded previous number…Please help me in doing this…If possible pls provide blocks for that…
Thankyou :blush:

you have to create an column with auto increment

You can use math’s addition block to add 1 with the previous order id. And you will the incremented order id or number.

1 Like

It is not working please read my previous mssg which will explain you what i really wants :blush: :blush:

I want when screen initialize that last recorder number +1 result should be seen in label

first fetch all row & get the number of row then added 1

May you post your blocks here??

I have read your topic and then I am telling you to do this with the addition block…


I tried Putting SQL query but that doesn’t work

Sorry for that :pensive:

@Saksham , You should run this query SELECT COUNT (*) FROM trans;
This query will return you the total no. of rows and then simply you have to add 1 with that and you will get the new id or number

But in this blockmath_add

this is not getting addedtext

OMG I am shocked. You are using MYSQL and didn’t know this…
@Saksham , my mean is to say that you have to run my query in your database with web and you have to get the result from web. Got Text event. There you will get the total number of rows in csv format.

Web got text>> run query2 Query>> select list item list response content index 2 + 1

It is not adding 1 the last number is coming with a space thats why it is not able to add . how to remove that space

However , we must be careful if it is allowed to delete records

Max(Namefield)+1 should return the last +1 to you. OK ?
But, depending on the system, some record might have been deleted.

I want, it calls only last number present in list and show +1 to label

I have already answered :thumbsup:

List ? Database , Mysql or Sqlite ?

You need to parse the data first to a list with list from csv text block. It will return a list of 2 sublists. You have to get the data from that like this.

Total no. of rows are in global total row variable. You have to just add 1 in it. Y
You’re good to go.