Hi, I have an SQL string as a parameter into the grid's event bound to an aureliusdataset.
In this event, I pass the string to the Linq.sql method.
If the filter is on the simple property all is ok.
If the filter is on an entity (association), I get an error from firedac,
because the entity in the SQL string has the property's name and the value is an object reference.
e.g.
AFilterText = '(Modello = ''1721'') AND (Owner = 430294104)'.
At the database level "Owner = Owner_Id" and the value = 1.
How can I apply the right string?
Is there a way to parser the SQL string as an Aurelius query?
The "owner" is an Entity and the value is an object reference.
my code : dsParti.Close; Cursor := AureliusManager1.Find<TParte>.Where(Linq.Sql(AFilterText)).Open; dsParti.SetSourceCursor(Cursor); dsParti.Open;
You text confused me because you are talking about SQL string, then Linq.SQL, then Filter string. It's not clear to me what is what.
You also didn't even mention which FireDAC error you get.
If "Owner" is an Entity, what does it has to do with an SQL statement, which only sees table columns?
When using Linq.Sql, you must provide raw SQL snippet to it. You can add {PropName} syntax to the text so Aurelius will replace PropName by the underlying SQL table column name, but yes, you can't use an association name, because an association might have even more than one column names representing it.