Topic: Show current id on form

Hello friends,

Is it possible to show the current id on the form? I tried to add an edit box, referring to table X and field id but nothing shows in the edit box.

I would actually like to perform an SQLexecute based on the ID of the record that is currently shown in the form that is being opened, this way i could hide the text box and use the value.

Thanks

2 (edited by derek 2019-06-16 19:07:52)

Re: Show current id on form

Hello Kristof,
I don't believe you can directly display the table ID of a record on a form, so I'd simply use a calculated field instead.
But if you want to perform an sqlexecute statement based on the ID of the record, the ID doesn't actually need to be displayed anywhere - you should be able to retrieve it from the calling form's tablegrid ID  - 
sqlexecute('select fieldname from tablename where id =' +form1.tablegrid1.sqlvalue);
Derek.

Post's attachments

Attachment icon showid.zip 340.9 kb, 356 downloads since 2019-06-16 

Re: Show current id on form

Hello.


Button with action "Save Record" has property  dbGeneralTableId, using this property you can get id of displayed record of form

Form1.Button1.dbGeneralTableId
Dmitry.

Re: Show current id on form

derek wrote:

Hello Kristof,
I don't believe you can directly display the table ID of a record on a form, so I'd simply use a calculated field instead.
But if you want to perform an sqlexecute statement based on the ID of the record, the ID doesn't actually need to be displayed anywhere - you should be able to retrieve it from the calling form's tablegrid ID  - 
sqlexecute('select fieldname from tablename where id =' +form1.tablegrid1.sqlvalue);
Derek.

Ahhh yess Derek!! Thanks so much again!


sqlexecute('select fieldname from tablename where id =' +form1.tablegrid1.sqlvalue);

Exactly what i needed, works perfect!

Re: Show current id on form

DriveSoft wrote:

Hello.


Button with action "Save Record" has property  dbGeneralTableId, using this property you can get id of displayed record of form

Form1.Button1.dbGeneralTableId

I didn't know this, thank you for the tip Dmitry! Will come in handy in the future.