Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

how to increment suufix of this string?

 
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a table in sqlite. That table contains 2 column - 1. RoomID and 2. RoomName.
What I want is if user enter roomname which is already exist then in database it is already entered as another roomname. suppose in table I have roomname as
1.Hall
2.Bedroom
3.Kithchen

and now suppose user enter roomname as Hall again then it is automatically entered as "Hall1" , again user enter same name then it will be "Hall2" and so on...
therefore database contains

1.Hall
2.Bedroom
3.Kithchen
4.Hall1
5.Hall2

I have following method to insert into database


and



How to increment suffix of roomname?

Thanks in advance.



 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't it be easier to keep the number in the separate column ?
 
Pramod P Deore
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Christophe Verré.

But if suppose I had add another column for suffix. But i don't know how to insert value of this suffix? Because first column is roomId which is autoincremented each time. second is roomname which is choosen by user from list (I am displaying list of rooms and user choose one name from that list). But I am not sure what value I should insert to the last column(i.e for suffix)
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's call it room number :
 
Pramod P Deore
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok Sir, It will give me the highest room_number . But how to insert this value here




here RoomID automatically increment each time.
and RoomName is selected by user from list of roomname
Now what about RoomSuffix?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It defaults to null. You'll set it yourself for duplicates.
 
Pramod P Deore
Ranch Hand
Posts: 633
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you sir, It solves my problem.
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!