Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Yet Another Auto-Increment Question

Post Reply
MrEngineer13
Posts: 3
Joined: Mon Apr 30, 2012 2:38 pm

Yet Another Auto-Increment Question

Unread post by MrEngineer13 »

I've read a couple posts around here about auto-incremental values but I haven't had any luck. The statement below is what is used to insert the data in to the table when I click on the Save Button. Is there anyway I can skip setting the reportNumber field in the following statement because the reportNumber value in the WHERE clause is correct:

UPDATE reports SET [...], reportNumber = '' WHERE reportNumber = '100039'

I've tried leaving reportNumber blank which only makes it's value "" and I've tried changing it to a date picker so it inserts NULL but auto-increment fields can't be NULL so it gets changed to 0.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Yet Another Auto-Increment Question

Unread post by admin »

MrEngineer13,

I'm not sure of what you are trying to do.

So I have a few questions.

Firstly why do you want to use an auto-incrementing primary key? Although we support it, its not the way nuBuilder is designed to work and for a number of reasons its not usually a good idea.

Secondly are you trying to display reportNumber on the form and if so, is it because the user needs to know the value of reportNumber.

(if an object on a Form has the same name as a field in the table, nuBuilder will save the object to the record)

Steven
MrEngineer13
Posts: 3
Joined: Mon Apr 30, 2012 2:38 pm

Re: Yet Another Auto-Increment Question

Unread post by MrEngineer13 »

Steven,

Yes, the user needs to know the value of reportNumber so I was displaying it on the forum as a read-only text field but that would cause nuBuilder to save the blank value over the correct one (more a flaw in my own logic than with nuBuilder). What would be the best method for just displaying the value to the user?

Thanks,
Mr.E
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Yet Another Auto-Increment Question

Unread post by admin »

Mr. E,

Use a Display object with different name and

Code: Select all

SELECT reportNumber FROM your table WHERE reportNumber = '#id#'
for the SQL

Steven
Post Reply