Thank you, that first thread is excactly what I need.
But, when I implement and run the code it tells me that the second field is an invalid identificator. But when I look into the exception and take the query executed and execute it manually it works fine.
IRelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.Relations.Add(CdmuserEntity.Relations.CdmudEntityUsingPrimdept, "Rekv", "Afd", JoinHint.Inner);
ResultsetFields fields = new ResultsetFields(4);
fields.DefineField(CdmuserFields.Uname, 0, "Init", "Rekv");
fields.DefineField(CdmuserFields.Lastn, 1, "Navn", "Rekv");
fields.DefineField(CdmuserFields.Direct, 2, "Tlfnr", "Rekv");
fields.DefineField(CdmudFields.Head, 3, "Afdeling", "Afd");
fields[1].ExpressionToApply = new DbFunctionCall("{0}||' '||{1}", new object[] { CdmuserFields.Firstn, CdmuserFields.Lastn });
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
adapter.FetchTypedList(fields, rekvirenter, bucket, false);
}
This is the error I get
ORA-00904: "HEST"."CDMUSER"."LASTN": invalid identificator
The query which actually is correct looks like this.
SELECT DISTINCT "LPA_R2"."UNAME" AS "Init", "HEST"."CDMUSER"."FIRSTN"||' '||"HEST"."CDMUSER"."LASTN" AS "Navn", "LPA_R2"."DIRECT" AS "Tlfnr", "LPA_A1"."HEAD" AS "Afdeling" FROM "HEST"."CDMUD" "LPA_A1" , "HEST"."CDMUSER" "LPA_R2" WHERE "LPA_A1"."ID"="LPA_R2"."PRIMDEPT"
Is any more information needed?
/Kasper