Welcome to the nuBuilder Forums!

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

subform object - foreignkey

Questions related to using nuBuilder Forte.
johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

subform object - foreignkey

Unread post by johan »

Hi

When creating a subform object, the foreign key disappears after saving.
When I look in the table zzzsys_object, the ID is entered.
If I add a new row to my subform, it also disappears upon saving.
Any idea what is going wrong?
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: subform object - foreignkey

Unread post by kev1n »

The foreign key field uses the following SQL query. Replace #sob_subform_table# with your actual table name, run it in phpMyAdmin, and check why it returns no rows.

Code: Select all

SELECT column_name, column_name
FROM information_schema.columns
WHERE  table_name = '#sob_subform_table#'
AND table_schema = database()
AND COLUMN_KEY <> 'PRI'
Capture.PNG
You do not have the required permissions to view the files attached to this post.
johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: subform object - foreignkey

Unread post by johan »

Kev1n

This is the error

SELECT column_name, column_name
FROM information_schema.columns
WHERE table_name = zzsys_bijlagen
AND table_schema = database()
AND COLUMN_KEY <> 'PRI' LIMIT 0, 25
MySQL meldt: Documentatie

#1054 - Onbekende kolom 'zzsys_bijlagen' in WHERE

Johan
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: subform object - foreignkey

Unread post by kev1n »

Write it like 'zzsys_bijlagen'
johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: subform object - foreignkey

Unread post by johan »

Kev1N
Now I get an empty result, no error.

Johan
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: subform object - foreignkey

Unread post by kev1n »

ChatGPT says:

This query might return no rows because:

No matching columns: The table zzsys_bijlagen might exist, but all its columns are either primary keys (COLUMN_KEY = 'PRI') or have a NULL/empty COLUMN_KEY.

Wrong database: database() may not match the schema where zzsys_bijlagen exists.

Case sensitivity: The table name 'zzsys_bijlagen' may not match the actual case-sensitive name in information_schema.columns, depending on the database's collation and OS.

Non-existent table: The table might not exist at all in the current schema.
johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: subform object - foreignkey

Unread post by johan »

Kev1n

Not so clever but of course I had to replace database() with the name of my database as well.
After this all the fields are shown.
I also see this when I create the object. But once saved, this is not shown again.

Johan
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: subform object - foreignkey

Unread post by kev1n »

Would it be possible to upload a sample database with the relevant tables/forms? That way, I can check where the error is coming from.
Otherwise, it's quite difficult to identify the cause without seeing the database schema, etc.

It can also be a simplified or copied version—just a minimum reproducible example.
johan
Posts: 422
Joined: Sun Feb 27, 2011 11:16 am
Location: Belgium
Been thanked: 3 times

Re: subform object - foreignkey

Unread post by johan »

Kev1n

Thanks for your support.

Johan
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4428
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 74 times
Been thanked: 475 times
Contact:

Re: subform object - foreignkey

Unread post by kev1n »

Could you also dump a sample form with the subform object on it? (Use the cloner)
Post Reply