Thanks for this preview/tutorial. I can’t get the value of one of my reference fields set for some reason.
I got this customers table, which has a customer_id (increments/key) field.
In my orders table I got a customer reference field:
In my action file I am creating a customer record in the customers database table and want to store the output’s identity field in the orders table’s customer reference field, but for some reason the field stays empty (null). What am I doing wrong here?
BTW: When (re)naming the orders table’s customer reference field to customer_id (same name as the key/increments field of the customers table, like you did in your preview post here), the database manager gets tangled up: The field can’t be changed anymore then, the customers table customer_id value is changed to a reference type field then and applying database changes throws errors then. I had this problem with several reference fields yet, so I think it might be a bug.
Are you sure the binding you are using there actually returns a value?
Create a setvalue step, use the same expression there, enable the setvalue output and do the insert.
In your browser check if the setvalue step returns a value (only the last 3 screenshots of this tutorial):
I am not sure i understand the issue explained here.
Do you mean that after you create a reference field and then you try to rename it, you can't rename it?
I did this and the value appears to be empty indeed. I don't understand how that is possible, because the record I am getting the identity field from is successfully created in the insert_customer step:
Do you have any clue?
No, that's not what I meant. The problem occurs when a reference field in table B is named or renamed a non-unique name (the same name as the foreign field in table A). If it's still not clear or you can't reproduce this, I can should a video or screenshots of this later.
When changing the name of reference field order_lines to order_record_id, like this:
(or on creation of a new reference field with that same name as the foreign order_record_id name)
Then this happens after applying the database changes:
The order_record_id field in order_records becomes a reference field too. When the order_record_id field is clicked from the orders table, the order_records_id field from the order_records gets selected and the field can't be modified anymore.
I do understand this is kind of confusing, but I wouldn't know how to explain this better..
While the renaming issue was solved in the latest update fortunately (thanks for that! ), there are remaining issues when editing reference fields, more specifically when removing or changing them.
I tried changing On delete and On update properties for a reference field, which returns this error while applying the database changes:
@patrick, @Teodor, @George, I want to praise you for the amazing improvements that are included in Wappler 3.0.0 and up regarding the database manager and support for postgresql databases with reference fields!