Ok, I can update text or number values in tables, but I’m stuck when it comes to linked records.
The documentation is kind of cryptic on this part and did not find good examples anywhere.
So if some coder could help me figuring out, That would be appreciated.
My goal is to have a base that contains the capabilities of each of the people of our association, the list of tests they can do, accept incoming request for trainings and list all trainings performed. Only experts can perform trainings
I’ve got 4 tables in a base:
-
People
-
Tests
-
Request
-
Trainings
Basically, a person (trainee-name) would create a request via a form, that would add a line in the base ‘Request’.
When he selects a test in training-request, that shows all potential tutors that are Experts for this test.
We would then choose a tutor and click on the button to create a line in “Trainings”
The current table Trainings was filled by hands and I want it to be scripted-filled by pressing button in Request table
At the moment, it uses the copy function the button but that kills the link and just paste the text
After that, when the training is done, i want to have a button that would change status of the training and create a link between the “training-request” test and the “trainee-name” in People table (in “Trained” column)
In addition, I would like that the column Tutor potential in Request table, lists only the tutor for the specified training-request. At the moment, it’s only listing the experts whatever the test.
My current code is not working and I don’t get how to solve that…
I made a list of interacting links :
Request.Trainee name ↔ People.Request
Request.training-request ↔ Tests.Request
Request.Tutor chosen ↔ People.Tutor selected
Trainings.Trainee name ↔ People.Trainings asked
Trainings.Tutor chosen ↔ People.Trainings made
Trainings.training-request ↔ Tests.Trainings
and
Request.Tutor potential is a lookup formula from training-request with the Tests.Experts column
First code : goal is to create a “training” row in the Trainings table from one request. That would be done with a button that would paste all info from “Request” to Trainings.
For now, I know how to create a line with the request ID copy pasted.
const table_request = base.getActiveTable();
const table_training = base.getTableByName(‘Trainings’);
const row = base.context.currentRow;
let input_Request_ID = row[‘Request-ID’];
base.addRow(table_training, {‘Request-ID’: input_Request_ID}, ‘Default View’);
);
but I can’t apply the same logic to linked column.
so I have created all references :
const table_request = base.getActiveTable();
const table_training = base.getTableByName(‘Trainings’);
const table_people = base.getTableByName(‘People’);
const row = base.context.currentRow;
let Request_Trainee_name = base.getColumnLinkId(‘Request’, ‘Trainee name’);
output.text(Request_Trainee_name);
let Request_Training_request = base.getColumnLinkId(‘Request’, ‘training-request’);
output.text(Request_Training_request);
let Request_Tutor_chosen = base.getColumnLinkId(‘Request’, ‘Tutor chosen’);
output.text(Request_Tutor_chosen);
let Trainings_Trainee_name = base.getColumnLinkId(‘Trainings’, ‘Trainee name’);
output.text(Trainings_Trainee_name);
let Trainings_Training_request = base.getColumnLinkId(‘Trainings’, ‘training-request’);
output.text(Trainings_Training_request);
let Trainings_Tutor_chosen = base.getColumnLinkId(‘Trainings’, ‘Tutor chosen’);
output.text(Trainings_Tutor_chosen);
let People_Request = base.getColumnLinkId(‘People’, ‘Request’);
output.text(People_Request);
let People_Training_asked = base.getColumnLinkId(‘People’, ‘Trainings asked’);
output.text(People_Training_asked);
let People_Training_made = base.getColumnLinkId(‘People’, ‘Trainings made’);
output.text(People_Training_made);
let People_Tutor_selected = base.getColumnLinkId(‘People’, ‘Tutor selected’);
output.text(People_Tutor_selected);
let Tests_Request = base.getColumnLinkId(‘Tests’, ‘Request’);
output.text(Tests_Request);
let Tests_Trained = base.getColumnLinkId(‘Tests’, ‘Trained’);
output.text(Tests_Trained);
let Tests_Trainings = base.getColumnLinkId(‘Tests’, ‘Trainings’);
output.text(Tests_Trainings);
And I have all my references for linkID :
kT86
v0r4
bGnK
984E
yxi5
1y2U
kT86
984E
1y2U
bGnK
v0r4
8WuT
yxi5
but how to add a row in Trainings (Trainings_Trainee_name) with the value from (Request.Trainee name) ?
I’m lost in these interactions ^^