Page 1 of 2
subform object - foreignkey
Posted: Tue Jun 24, 2025 10:17 am
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?
Re: subform object - foreignkey
Posted: Tue Jun 24, 2025 11:01 am
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
Re: subform object - foreignkey
Posted: Tue Jun 24, 2025 11:19 am
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
Re: subform object - foreignkey
Posted: Tue Jun 24, 2025 11:24 am
by kev1n
Write it like 'zzsys_bijlagen'
Re: subform object - foreignkey
Posted: Tue Jun 24, 2025 11:30 am
by johan
Kev1N
Now I get an empty result, no error.
Johan
Re: subform object - foreignkey
Posted: Tue Jun 24, 2025 11:45 am
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.
Re: subform object - foreignkey
Posted: Tue Jun 24, 2025 12:15 pm
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
Re: subform object - foreignkey
Posted: Tue Jun 24, 2025 12:44 pm
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.
Re: subform object - foreignkey
Posted: Tue Jun 24, 2025 1:07 pm
by johan
Kev1n
Thanks for your support.
Johan
Re: subform object - foreignkey
Posted: Tue Jun 24, 2025 1:21 pm
by kev1n
Could you also dump a sample form with the subform object on it? (Use the
cloner)