Connect 2 entries
Hello.
I have this code in the table Solicituds in a button:
let dniActual := DNI;
let personaEncontrada := (select Personas where DNI = dniActual);
if count(personaEncontrada) > 0 then
alert("El DNI ya existe.")
else
alert("El DNI no existe.")
end
I want that, if count(personaEncontrada) > 0 the entries that exists in both are relationships with each other. Like As if I choose in the Relationship field the record to connect.
Thanks.
10 replies
-
Can you post a sample DB?
-
Sorry I cant, I have Starter plan.
The think is:
Database Solicituds <-> Database Personas
DNI field in Solicituds
DNI field in PersonasIf DNI > 0 (find the same DNI field in Solicituds and Personas), then both entries with the coincident DNI in Solicitud and Personas needs to be linked.
Thanks.
-
said:
Database Solicituds <-> Database Personas
DNI field in Solicituds DNI field in Personas
If DNI > 0 (find the same DNI field in Solicituds and Personas), then both entries with the coincident DNI in Solicitud and Personas needs to be linked.Thankfully, you only need to link on one end. Is there a 1 to many link between Solicituds and Personas? or will there only ever be a 1:1 relationship?
If there will be a 1 to many, which end is the many side? If you edit the reference field you will see something like:
This means that there is 1 Invoice to many Data Entry.
Another way to tell which side the table is on is if you see if the relationship fields shows up as a single field or a table. The single field means it is the many side (it can link to only 1 record). If you see a table then that means the table is the 1 side, the table shows the many records that are linked to it.
So on 1 side table you can create a button with:
let t := this; let otherTableRecs := (select otherTableName where DNI = t.DNI); for loop1 in otherTableRecs do loop1.(referenceFieldName := t) end
Content aside
- Status Answered
- 1 mth agoLast active
- 10Replies
- 50Views
-
2
Following