Hello!
My applaud to the developers of Saltcorn - it seems to be user friendy but yet versatile, just what I'm looking for. So I really would like to use it, but I've met one difficulty that totally halts me. I hope someone can help me with this:
I have watched several times on YouTube the "Saltcorn table relationships" tutorial but I'm not able to reproduce what they do there. My case is very simple. I have two tables: "Table1" which has as a main parameter "electronic-device" (a number), and then a "Table2" which has a main parameter "installation-site" (also a number). I then add a key in "Table2" pointing to "Table1.electronic-device", and I can manually add electronic-devices to the chosen installation-sites. (There must be a unique relationship so that an "electronic-device" can only appear in one "installation-site"). So far so good. But when I create a view for "Table1", I would like this view to show also as a Join Field the "installation-site", which should appear in the same list-row as the "electronic-device" as the latter was assigned to in "Table2", but I just can't make it work no matter how hard I try. I get no error-messages but the "installation-site" never shows up.
Is there a bug, or is there a trick to solve this? I'm using:
Saltcorn version 1.0.0-rc.5
Node.js version v18.20.4
Database type PostgreSQL 12.20
On Ubuntu Linux 20.04.6
Thanks in advance for somebodys answer.
- Einar
Einar,
Think you may have the design back to front. Very quickly put together but I thinkit ticks all your boxes. Have a play around and see how it goes!
Create Table1 as follows. Note the keytotable2 is created on Table1. Note also the Unique properties has been set for the keys too and they are required fields!
Create Constraint on Table1:
Edit Table1 install-site and tick uniqueness and required.
Create Table2
Edit Table2 install-site and tick uniqueness and required.
Hope this helps you!
Dear Gaz,
Thank you, much appreciated. And it actually also works as I want it to work when I clone how you did it. I have some strange reasons why I still cannot get it right when using my tables. I need e.g. my key to actually go the opposite way. But you have given me enough confidence to keep going and make it succeed eventually.
Thaks again, Einar
test