How can I get the Id number of a record in a linked table?
I have three tables: MasterList, MasterListLabels, and Projects.
MasterList has a field called "Type" that is linked to MasterListLabels.
When I add a record to the Projects table, I click on a button to create a record in the MasterList table, and in that record I need to populate the "Type" field that is linked to MasterListLabels. This code works:
let m := (create MasterList);
m.(Type := 34); // 34 is the relevant record ID in the MasterListLabels table
However, I don't want to specify "34" in my code, I want to use a variable. But I have not been able to figure out how to define that variable. I have tried the following, but none of them work - all of them return null or give an error that 'thistype' returns multiple values:
let thistype := (select MasterListLabels['Label' = "Project"].Id);
m.(Type := thistype)
--
let thistype := (select MasterListLabels['Label' = "Project"].Id);
m.(Type := number(thistype))
--
let thistype := number((select MasterListLabels['Label' = "Project"].Id));
m.(Type := thistype)
--
let thistypepre := (select MasterListLabels['Label' = "Project"]);
let thistype := number(thistypepre.Id);
m.(Type := thistype)
Is there a way to make this work? Thanks!
2 replies
-
Try this:
let thistype :=first(select MasterListLabels['Label' = "Project"].Id);
m.(Type := thistype)
Steven
-
works, thanks!
Content aside
- 5 yrs agoLast active
- 2Replies
- 1801Views