Welcome to the nuBuilder Forums!

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

#RECORD_ID# within a subform

Questions related to using nuBuilder Forte.
Post Reply
nickrth
Posts: 28
Joined: Sun Aug 23, 2020 3:19 pm
Has thanked: 1 time
Been thanked: 1 time

#RECORD_ID# within a subform

Unread post by nickrth »

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

SELECT '#RECORD_ID#', '#RECORD_ID#'
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.
You do not have the required permissions to view the files attached to this post.
nac
Posts: 115
Joined: Tue Dec 12, 2017 11:28 pm
Location: Aberdeen, UK
Has thanked: 9 times
Been thanked: 12 times

Re: #RECORD_ID# within a subform

Unread post by nac »

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()) {  
    nuPopup('606b1cefbada7f2',nuSubformRowId(this))    

} 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.

Neil
kev1n
nuBuilder Team
Posts: 4302
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: #RECORD_ID# within a subform

Unread post by kev1n »

Hi,

Try the attached nuform.js. Replace yours with the one from the attachment and then log in again into nuBuilder.
nuform.zip
You do not have the required permissions to view the files attached to this post.
nickrth
Posts: 28
Joined: Sun Aug 23, 2020 3:19 pm
Has thanked: 1 time
Been thanked: 1 time

Re: #RECORD_ID# within a subform

Unread post by nickrth »

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

Legend!!
Post Reply