#RECORD_ID# within a subform

Questions related to using nuBuilder Forte.

#RECORD_ID# within a subform

Unread postby nickrth » Sun Jul 04, 2021 7:40 pm

Hi brains trust,

I have a form with a subform, and I'm trying to use the subform's record id to drive a SQL statement for a select object. But #RECORD_ID# appears to return the same value for all rows in the subform.

In the screen shots below I have done a basic test to just return the record id for the given row in the select object. This is the sql code on the relevant select object:
Code: Select all

And it renders the record id of the first row in the subform, for every row in the subform.

If I change it to a display object with the exact same SQL as above, it shows different IDs per record, as I'd expect.

Can anyone see what I'm doing wrong?

Thanks in advance.
display.jpg (15.39 KiB) Viewed 396 times
row 1
row1.jpg (23.16 KiB) Viewed 398 times
row 2
row2.jpg (29.14 KiB) Viewed 398 times
Posts: 19
Joined: Sun Aug 23, 2020 10:49 pm

Re: #RECORD_ID# within a subform

Unread postby nac » Mon Jul 05, 2021 6:29 pm

hello nickrth

The function nuSubformRowId(this) will return the PK value for a row in a subform. I use the code below with an onclick button in each row to open a modal form for the specific subform record.

Code: Select all
if (nuIsSaved()) { 

} else  { 
    nuMessage(["Please save any changes before leaving this form."])

You could set a hash cookie using the value returned by nuSubformRowId(this) to feed into your SQL statement.

Posts: 72
Joined: Wed Dec 13, 2017 7:58 am
Location: Aberdeen, UK

Re: #RECORD_ID# within a subform

Unread postby kev1n » Mon Jul 05, 2021 9:17 pm


Try the attached nuform.js. Replace yours with the one from the attachment and then log in again into nuBuilder.

(25.73 KiB) Downloaded 39 times
nuBuilder Team
Posts: 2122
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: #RECORD_ID# within a subform

Unread postby nickrth » Tue Jul 06, 2021 5:23 pm

That works perfectly kev1n! Thank you so much for your prompt help, I really appreciated it.

Posts: 19
Joined: Sun Aug 23, 2020 10:49 pm

Return to General

Who is online

Users browsing this forum: miasoft and 15 guests