Welcome to the nuBuilder Forums!

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

Are Lookups what I need (and some other basic questions)?

Questions related to using nuBuilder Forte.
Post Reply
Keith-i
Posts: 88
Joined: Wed Jan 18, 2023 3:03 pm
Has thanked: 1 time
Been thanked: 1 time

Are Lookups what I need (and some other basic questions)?

Unread post by Keith-i »

I am trying to create a new database for my office which revolves around a list of jobs with a date, a client name and a property address. I have 3 tables in total namely:
Instructions table with fields for job number, date, client name, surveyor_id, house name, and road_id.
Surveyors table with fields for primary key (surveyor_id) and surveyor name. (This table has been imported and already holds data)
Roads table with fields for primary key (road_id), road name and postcode. (This table has been imported and already holds about 1,000 records)

Very simply I think I need a main browse and edit form from which I can enter the job number, date, client name, and then I need to be able to select the appropriate surveyor from the related Surveyors table and also the road name from the related Roads table. I am presuming a Lookup is used to get the data from the related table with just the surveyor_id or road_id being saved in the main table but having the browse form show the related surveyor name and road name. (Given that I have 1,000 or so records in the roads table I need to be able to filter these to make selecting the correct road easier). I would appreciate being corrected if I am wrong on the principles behind this and aslo how to make sure the correct field is bound to the main table. I did all this with Access some years ago but am having difficulty getting to grips with nuBuilder.

On a separate note, from the documentation there is reference to naming conventions. Are these critical? Playing around and trying to learn nuBuilder I have deviated from these but it doesn't seem to make any difference as far as I can tell. Examples I am referring to are naming fields with a three digit identifier followed by underscore and using three capital letters for form codes.

The simplest explanation you can bear to give me would be appreciated whilst I try to get off the ground.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Are Lookups what I need (and some other basic questions)?

Unread post by kev1n »

Hi,

Exactly, lookup fields are the right choice. Basically, you create 2 browse forms with Fast Form (Form Builder): One for Surveyors and on for Roads.
On the main form, you add to lookup fields.

Videos about Lookup Fields:

https://www.youtube.com/watch?v=QzIuQqbdxj0
https://www.youtube.com/watch?v=Qf_VtmwXi4s

User Guide, p. 55

The naming conventions are not strict requirements, and deviating from them is not necessarily a problem. Ultimately, the goal of naming conventions is to make code, tables more readable and easier to understand, but as long as the names you choose serve this purpose, it's up to you to decide how to name things.
Keith-i
Posts: 88
Joined: Wed Jan 18, 2023 3:03 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Are Lookups what I need (and some other basic questions)?

Unread post by Keith-i »

Hi kev1n

Thanks for the affirmation and also the link to the documentiation. With the help of the worked examples I've made some great progress and am getting to where I need.

However, one further interim question for you please. On the edit screen, once you've entered a new record and clicked 'save' is there any way to automatically move onto a new blank record ready to enter the next data set? At the moment I have to go back to the main browse form and click 'add' again to get to a new blank edit screen. Presumably there is some 'after update' code I can put somewhere to achieve this. Or is there any way I can add a button onto the edit screen to go to a new empty record?
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Are Lookups what I need (and some other basic questions)?

Unread post by kev1n »

In PHP AS (After Save), call

Code: Select all

nuReturnNewRecord();

https://wiki.nubuilder.cloud/index.php? ... nNewRecord
Post Reply