Welcome to the nuBuilder Forums!

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

nuAutoNumber value in AfterSave empty

Questions related to using nuBuilder Forte.
Post Reply
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

nuAutoNumber value in AfterSave empty

Unread post by marc »

Code: Select all

nuAutoNumber
nuAutoNumber is a read-only nuBuilder Input field that will be populated once the Edit Form it is on, is saved for the first time.

It will be populated with an incrementing number.

It requires Next Number - The number this Autonumber will start from.
I need your help. I have created an object that contains an autoincrement value. How do I retrieve the value of an autoincrement field after saving a record? I would like to insert this value in the subject of an email that will be sent.

This always gives an empty value.

Code: Select all

nuDebug("#cust_autonumber#");
This did not help either.
https://forums.nubuilder.cloud/viewtopic. ... ash#p17912

Code: Select all

nuDebug(nuHash()['cust_autonumber']);
After saving, however, the value is in the field. It is also stored correctly in the database.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuAutoNumber value in AfterSave empty

Unread post by admin »

marc,

You'll need to get it from the database on After Save.

Code: Select all

$s = "SELECT cust_autonumber FROM customer WHERE customer_id = '#RECORD_ID#'"

Steven
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: nuAutoNumber value in AfterSave empty

Unread post by marc »

Hi there, someone (can't remember the name) posted a useful function and the post is gone today :(
I had no time yesterday to copy it. Please restore the post if possible. Thank you!
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuAutoNumber value in AfterSave empty

Unread post by admin »

marc,

Sorry I can't.

I'll finish what I hinted at before...

Code: Select all

$s = "SELECT cust_autonumber FROM customer WHERE customer_id = '#RECORD_ID#'";
$t = nuRunQuery($s);
$r = db_fetch_row($t);

$an = $r[0];    //-- autonumber

Steven
marc
Posts: 92
Joined: Mon May 14, 2018 3:26 pm

Re: nuAutoNumber value in AfterSave empty

Unread post by marc »

Thank you very much
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuAutoNumber value in AfterSave empty

Unread post by admin »

.
Post Reply