Auto-populate field in child table with data from parent table
Hello, I'm trying to figure out how to carry over an ID field from one table to a related table - - for example, from within my Clients table I want to create a record in a linked Projects table and have the ClientID field on the project record auto-fill with the associated ClientID value. I've tried setting it as default value, or a formula to copy the value, but it doesn't seem to work either way. Any suggestions? Many thanks!
6 replies
-
From my understanding, the ID-field is the one field that is truly unique and cannot be modified. You can however return / show the Id of linked table. Simply create this formula: LinkedTableName.Id
-
Thank you, Jarno Vande Walle . I haven't explained myself well. My Client Info table contains a ClientID field separate from the record ID that I manually populate. The Projects table is embedded on a Client Info view, and when I create a new Project record in the embedded table, I'd like it to auto-populate with the associated ClientID so each project record includes a link to the associated client. I've tried setting the default value to 'Client Info'.ClientID, but that doesn't work - - the field remains blank and I have to manually search for the client. The relationship is "Reference from Projects to Client Info (N:1). It seems like this should be easy, but I think I'm missing or misunderstanding something fundamental!
-
You need to create a button ( add project for example) in your Client info form, and use this script:
let me:=this;
let cid:=ClientID;
let c := create Projects;
c.("Client Info":=me;
ClientID := cid);
openRecord(c)
-
RoSoft_Steven Thank you. I'm trying this but it's returning a syntax error that I can't seem to correct - - just a newbie here, flying blind with no knowledge of code. Adding ) where it seems indicated isn't working. What do you suggest?
and
-
RoSoft_Steven Jarno Vande Walle - - Thank you both again. I'm not sure what I was getting wrong before, but now your suggestion, Jarno Vande , is working perfectly well - - I figured out how to set it up using visual coding rather than text, so I must have been making some kind of syntax error. At any rate, thank you both for your help!
Content aside
- 1 yr agoLast active
- 6Replies
- 371Views
-
3
Following