Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Relation n:m in nuBuilder

Locked
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Relation n:m in nuBuilder

Unread post by massiws »

Hi,
I have some dubts working on a new project about technical manitenance and hope someone can give me some suggestions.
I have two table appointment and technician with relation n:m, so one technician can have zero or more appointments and one appointment can be fixed for one or more technicians.
In database I set three tables:

appointment
- app_id
- app_apt_id
- app_data
- app_time

technician
- tec_id
- tec_apt_id
- tec_name

appointment_technician
- apt_it
- apt_app_id
- apt_tec_id


When users insert a new appointment should have the possibility to assign one or more technician to that work, so I think to use appointment as primary table and technician in the subform.
In another form I can show all the appointments of a technician by placing a subform-appointmens on primary-technician-form.
Am I right?
The appointment_technician table must be managed by custom code in AfterSave tab or there are some shortcuts?

The second question in relative to app_time field in appointment table.
Can I insert a new format time that can be selected from the available formats in object format field on text tab?

All suggestions are welcome!
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Relation n:m in nuBuilder

Unread post by admin »

massiws,
Untitled11.png
Untitled11.png (17.25 KiB) Viewed 12436 times
This is the best way to make it work..

A is the Form
B is the Subform with C a Lookup in the Subform.

In both cases the Subform is appointment_technician which means appointments and their technicians can be added and viewed from either Form.

Steven
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Relation n:m in nuBuilder

Unread post by massiws »

Steven,

thanks for answer: following your suggestion and working on it two days I get good results, but one thing I haven't be able to solve.

Please, have a look at this image:
Auto-fill fields in subform from previous form.
Auto-fill fields in subform from previous form.
snapshot.png (68.29 KiB) Viewed 12411 times
When I add a new record in appointment (Appuntamenti) is possible to get the number in Num Intervento from the request table to auto-fill the corresponding field in appointment_technician table (number 4 in the image above)?

Following the wiki, I tried to put some code in AfterBrowse and BeforeOpen of appointment form, but I can't get any value..

Thanks.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Relation n:m in nuBuilder

Unread post by admin »

massiws,

I'm not exactly sure, but do you know how to use this bit (Update other Fields)..?
Capture.PNG
Capture.PNG (21.5 KiB) Viewed 12407 times
Steven
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Relation n:m in nuBuilder

Unread post by massiws »

Steven,

yes, I know how to use lookup fields, but my answer was another.

If I have a formA with a browse-subform subformB inside, when I press the Add new record in the subformB it opens a formC.
I want to take one parameter from formA to auto-fill a field in the new record in formC.
In other words, how can I refer one field on a main form from a browse subform?

Following your wiki "Subform Properties for version 2.6", I can insert a new invoice directly from the browse-subform pressing Add record button.
But how can I fill the Customer code field in the new record taking the value from the corresponding field displayed in Customer form?
When you open a new record from a browse-subform, which variables still contain values from the main form?

Excuse my awful English! :oops:
Thanks.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Relation n:m in nuBuilder

Unread post by admin »

massiws,

I understand now but nuBuilder has no way of doing what you need (at the moment).

Steven
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Relation n:m in nuBuilder

Unread post by admin »

massiws,

Actually you will be able to do it in the next release.. (v2.7.4.8)

This is how it will work.. http://www.youtube.com/watch?v=6d_nYErMGPI

Steven
massiws
Posts: 503
Joined: Thu May 24, 2012 2:08 am
Location: Milan, Italy
Contact:

Re: Relation n:m in nuBuilder

Unread post by massiws »

Steven,

you're working hard, and this is greatly appreciated!
I'll try the new feature as soon as it's available.

Thanks lot.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Relation n:m in nuBuilder

Unread post by admin »

.
Locked