Button for create a new record which has a connection to a record
I have a table, where in every record, i have a connection of records from a different table showing up. (1:N)
when want to get a new record, normally click "+ Neuer Datensatz" at the 1:N, and there i get a new record, which already has automatically a connection to the table. But then i use a button with the code:
create TableName
it just gives me a new record, but no connection to the table i am in.
12 replies
-
You can check out this post.
-
I can try.
You have a good start with:
create TableName
The issue you are encountering is you have not specified the record to link to the new record in TableName. Since I don't know the structure of your DB, let us start with the following:
2 tables - Table1 and Table2
Table1 is your main table with a 1:N relationship to Table2. There is a field in Table2 called 'linktoTable1' which is the reference field to Table1. It is not just a plain text field.
So in Table1 we create a button with the following:
let t := this let newRec := (create Table2) newRec.linktoTable1 := t
Line 1 creates a variable t that stores the Ninox recordId of the current record.
Line 2 creates a variable that first creates a new record in Table2.
Line 3 then takes that new record in Table2 then links the reference field 'linktoTable1' to the record that stored in the variable t.
Content aside
- Status Answered
-
1
Likes
- 7 mths agoLast active
- 12Replies
- 693Views
-
2
Following