
Take Date from another Table

I need to take a Date (FechaP1) in the ACTIVIDADES Table, from the DOCUMENTOS Table belonging to DISCIPLINAS.
The Orange Date, I try with these formula but take always the same dates
first((select DOCUMENTOS where Id = 887).FechaP1)
Or that but with error
first((select DOCUMENTOS where DISCIPLINAS.disciplina Id = 887).FechaP1)
Symbol expected ")" at line 1 column 56
-
Looking at an old DB, I see that Actividades has a 1:M relationship to Documentos, 1 record in Actividades has many related records in Documentos. So you don't need to do a select if you only want to get data from related records. For example if you wrote:
first(LF_Documentos.FechaP1)
It will return the data from FechaP1 of the very first record that is related to the record in Actividades.
But this only works if all related records in Documentos have the same FechaP1 date and I noticed that some don't. I don't know if that is just because this is sample data or this actually happens in your DB.
-
Fred
Right, not all documents have the same Dates each Documents has its own issue dates.
I don't change anything in relation database I have AVTIVIDADES 1 TO Many to DOCUMENTOS but the Formula don't work in the ACTIVIDADES Table.
But I can ACTIVIDADES M to M to DOCUMENTS
For example DISCIPLINAS Equipos (Equipments) have 3 Activities, General Equipos Activities, Especifications and Requisitions and each many Documents, but all documents is on Equipos.
The change I do is the RooUp the hours from Dompcuments to Activities to Disciplines to Project, and work good.
Anyway I send you the DB work
Thanks again.