Welcome to the nuBuilder Forums!

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

Variables on Subform->Button->RecordID (bug?)

esstein
Posts: 17
Joined: Tue Mar 08, 2011 12:45 am

Variables on Subform->Button->RecordID (bug?)

Unread post by esstein »

I can't use a variable of query result on subform button object.
nu-button.jpg
And the field is correctly added on SQL of subform:
nu-subform-sql.jpg
I'm asking because it is working on another older version of nuBuilder.

To it works I made one workaround:
1) setting a blank form on "Form To Launch via Browse";
2) setting the "venda_id2" (primary key venda_id + number 2) on "Field Name";
3) adding a JavaScript on "On Double Click":

Code: Select all

openForm('14fcd2c1fbdd61',document.getElementById(this.name.substring(0,this.name.length-1)).value);
It will back to work on future version?

Thanks in advanced!

Evandro
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Variables on Subform->Button->RecordID (bug?)

Unread post by admin »

Evandro,

Is this button on a subform?

Steven
esstein
Posts: 17
Joined: Tue Mar 08, 2011 12:45 am

Re: Variables on Subform->Button->RecordID (bug?)

Unread post by esstein »

Yes! Excuse my bad English. Thanks
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Variables on Subform->Button->RecordID (bug?)

Unread post by admin »

Evandro,

Although this works on the main Edit Form, on a subform, each Object has a prefix to its name..
Untitled.png
making it impossible to refer to it as you have tried.

You will need to find another way.

Maybe by updating an Object on the main Edit Form from the row you are currently on, with javascript. (maybe in the onclick of the button)

You could probably even call that field venda_id, as is it would clash with any other fields on the Edit Form and you wouldn't have to make any changes to your button.

Steven
You do not have the required permissions to view the files attached to this post.
esstein
Posts: 17
Joined: Tue Mar 08, 2011 12:45 am

Re: Variables on Subform->Button->RecordID (bug?)

Unread post by esstein »

Hi Steven,

I want to use the "Form To Launch via Browse" to open form. It stops to work on new versions of nuBuilder.

This is a picture of another system that I am using an old version of nuBuilder and the "detalhes" button opens the "Cooperados" form correctly with variable "#medico#" on RecordID:
old-version-the-button-is-working.png
I'm using JavaScript to the button works on new version, but it is a workaround.

---

On the actual version of nubuilder, I tried to use "#venda_id#" to open "frmVenda" form, but the variable "#venda_id#" is not replaced with query result value (number 7). This is the subform:
new-version-is-not-working.png
---

To work on new version I must to disable the "Form To Launch via Browse" and find the Record Id (r=7) using getElementById on the "ver" button:
recnum-7.gif
getElementById-name+1.png
The "openForm('14fcd2c1fbdd61',document.getElementById(this.name.substring(0,this.name.length-1)).value)" will find the correct record id.

If I use the same name on button object, the subform not show correctly. So, I used subform_NVenda0000venda_id2 (name.length+1) to find the value of subform_NVenda0000venda_id (name.length-1).


The best and simple way to open a form is use the "Form To Launch via Browse" button attribute. Have it some chance to #variable# back to be replaced with sql result on subform?


Thanks,
Evandro
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Variables on Subform->Button->RecordID (bug?)

Unread post by admin »

Evandro,

The function nuGetRowId() might make your JavaScript a bit easier.

http://wiki.nubuilder.com/tiki-index.ph ... uGetRowId_

Steven
esstein
Posts: 17
Joined: Tue Mar 08, 2011 12:45 am

Re: Variables on Subform->Button->RecordID (bug?)

Unread post by esstein »

It helps. Thanks.

By the way, why Record ID of Button object stops to replace db_fetch values?

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

Re: Variables on Subform->Button->RecordID (bug?)

Unread post by admin »

Evandro,

Sorry, I don't understand the question.

Steven
esstein
Posts: 17
Joined: Tue Mar 08, 2011 12:45 am

Re: Variables on Subform->Button->RecordID (bug?)

Unread post by esstein »

Hi Steve,

The configuration below stopped to work on new version of nuBuilder:
Image

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

Re: Variables on Subform->Button->RecordID (bug?)

Unread post by admin »

Evandro,

You can put the hash variable in Default Filter for Browse Screen.

But there is a bug.

Steven
Locked