How to make a relation column inherit the form context?

Hello, I’m creating a simple training application.

So I have the Teacher, Student, Student Training and the Training Exercise.
I made all the relationships in the tables and everything has been working well.
However, I’m having trouble registering.

Scenario: Teacher created a student and now he needs to create the student’s training, but at the time of creating the training, even though he is already in the student context, he needs to fill in the “relation_student” column.

So my question is, how do I make the relation column inherit the form context?

The relation column needs another column to find the right data in other tables / queries.

What have you done so far?

1 Like

@MaximeBaker
In the “training table” I have the exercise relation column: “relation_exercicis”


In the exercise table I have the training relation: “relation_treino_id”

I’m showing a different scenario than my first post, but it’s the same idea.

The only solution I found was to force the user to select the workout, even if he is already in that context.
But since I’m already in the training context. Ex: Day 2


I didn’t want to ask the user to select the workout again. Input “treino”. Ex: Day 2

In other words, I wanted the “relation_treino_id” column to be filled in automatically, without asking the user, as he is already in that context.

What action does the ‘Cadastrar’ button perform?

How are you creating that relation? I assume from an ID?

You can add a special value to the form, filling the Treino ID to the column in the destination table.

1 Like

@MaximeBaker

“Cadastrar” has an action to open the form to register the exercise.
Cadastrar is register in Portuguese.

@ThinhDinh
Yes, I am doing the relation by ID

But how do I do this?
I tried using this option in the print below, but it doesn’t even show the Relation column I need.


The second input, which is “treino_id” is the training ID, but there is no way (or I don’t know how) to choose it to be the ID of the context that the user is in.

What is the context of the form screen? Training?

1 Like

Here, you can use screen value of the id or name of the selected training and set the column to the training id in the target table.


2 Likes

@MaximeBaker

YOU ARE AMAZING BRO
It worked perfectly. I solved another problem with row owner, using the same concept it worked too

Thanks <3

1 Like

Anytime brother!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.