Welcome to the nuBuilder Forums!

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

Adding a field after a db was created

Questions related to using nuBuilder Forte.
Post Reply
Mike1961
Posts: 17
Joined: Wed Aug 11, 2021 7:11 pm

Adding a field after a db was created

Unread post by Mike1961 »

I built my db with several fields and created fast forms (browse and create/edit). All was ok

I tried to create another field (TT7_task_creator) into that dabase and didn't want to recreate one from scratch. The reason ? I want to add on the fly, hidden or not editable, a field with the name of the creator of the task (I'll insert automatically the name of the task creator later)
TT7- DB.jpg
I edited the properties of the browse and edit forms to reflect this addition. However, even the field seems properly inserted in the forms, When I browse or create a new task, the field is always empty. It appears only if I manage the db itself with phpmyadmin.
TT7_task_creator.jpg
TT7_task_creator (input-text).jpg
*EDIT*
It seems that adding a field directly into the db (phpmyadmin) is not necessary. the datatype was missing on the form (even created with phpmyadmin) and obtain an error (Nudebugresult). I "rebuilt" then the form and had no more errors and I'm able now to add the creator into the db.

just (in)validate the way I did before...

*EDIT II*

I suppose I need to add php code in the Before Save (add mode) to inject the name of the logged user into the TT7_tast_creator and make this field readonly. Like this ?

https://github.com/nuBuilder/nuBuilder- ... ve_user_id

Yep, it works ! ;-)
TT7_task_creator with automatic user_id insertion.jpg
Hmmm, it doesn't :-(

When I change the user name and choose somebody else (from my user list), the name is displayed as numbers and not the user name...
TT7_task_creator user_id failure (cryptic).jpg
When I check the zzzz_user_id, I (the admin) am displayed with a name, the users I created are just plain numbers. Will check on my side again to see why.
zzzzsys_user_id.jpg
No explanations. Just created another user. Name in NuBuilder is text, Id in zzzz_user_id is numerical
Users (added Simon).jpg
zzzzsys_user_id (added Simon).jpg
You do not have the required permissions to view the files attached to this post.
jut
Posts: 2
Joined: Thu Sep 16, 2021 2:56 am

Re: Adding a field after a db was created

Unread post by jut »

I also have this same issue and like you I tried to manually force the database columns into existence.
I tried running the upgrade feature which worked once or twice but this is still a huge problem for me, if you figure it out definitely let me know.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Adding a field after a db was created

Unread post by kev1n »

The foreign key is stored in the table. Use a join to retrieve the related columns from the other tables.

Google for database normalisation, joins.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Adding a field after a db was created

Unread post by kev1n »

As an example, see the user form's browse SQL where sus_zzzzsys_access_id contains the foreign key of the table zzzzsys_access.
A join is used to retrieve sal_code and sal_description from that table.
You do not have the required permissions to view the files attached to this post.
Post Reply