Welcome to the nuBuilder Forums!

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

Struggling with subform with no success

Questions related to using nuBuilder Forte.
Post Reply
absalom
Posts: 25
Joined: Sat Apr 03, 2021 3:50 pm

Struggling with subform with no success

Unread post by absalom »

Hi, I can't manage to figure out how to make a subform in a very simple situations; tried to match some online tutorials but can't make it work.

I have a very simple customer/orders situation: an "edit" form for a single customer, and I would like to browse orders from that customer. Of course, orders.customer_id is a foreign key to customer.id

What I did:

* have an "edit" form for the customer;
* put a "subform" object at the relevant location in the previous "edit" form (in the "subform" tab of this objects, I set the following form in the Form field and put customer_id in the Foreign key field despite the fact that no table can be referred to here)
* have a "browse" form for the orders with

Code: Select all

select * from orders where customer_id = #ID#
as SQL

But I see nothing; actually, I see the subform object but empty (empty means that I don't even see empty columns for the browse form).

After browsing a little here, I noticed the recent question: https://forums.nubuilder.cloud/viewtopic.php?f=19&t=10925
which tells about a "Run" object rather than a "Subform" one, but I thought that the Subform was exactly for what I need. Why doesn't it work on such a simple case?
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

Re: Struggling with subform with no success

Unread post by kev1n »

Hi,

This is SQL is sufficient.

Code: Select all

select * from orders
nuBuilder will create the relation to the customer table automatically.


I created a small demo here:
https://test.nubuilder.cloud/index.php? ... 1&h=nuhome

What I did:

1) Create a Form/table customer:

(cus_firstname and cus_lastname are "Input:Text" and cus_orders is a Subform)
customer.png
2) Create a Subform Form/table item:
(itm_description is "Input:Text" and itm_quantity "Input:Number"
item.png
Then open the customer Form and connect its Subform:
connect_subform.png
You do not have the required permissions to view the files attached to this post.
absalom
Posts: 25
Joined: Sat Apr 03, 2021 3:50 pm

Re: Struggling with subform with no success

Unread post by absalom »

Thank you; now it works.

How can I prevent rows to be deletable (I don't want the right checkbox to be displayed)?
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 447 times
Contact:

Re: Struggling with subform with no success

Unread post by kev1n »

Set Deleteable to No
You do not have the required permissions to view the files attached to this post.
Post Reply