When we have a Table Schema like this:
SELECT usr_Primkey, usr_LastName, usr_FirstName, usr_reg_Primkey
FROM User
LEFT JOIN Region on usr_reg_Primkey = reg_Primkey
Is there a possibility to use a WhereExpression on a field from the Region (for example reg_Description) table without it being available in the schema table (but obviously it exists in the database table)?
In general it is not possible to create a DynamicWhere expression referencing field not exposed in the server Schema.
Otherwise client app would be able to “probe” underlying database table for values of fields that are not exposed in Schema and therefore not expected to be accessible from client apps.
Possible solutions in your case are:
Expose additional fields in the Schema
Introduce Schema Table parameter like
SELECT usr_Primkey, usr_LastName, usr_FirstName, usr_reg_Primkey
FROM User
LEFT JOIN Region on usr_reg_Primkey = reg_Primkey
WHERE
reg_Description = :reg_Description OR (:reg_Description IS NULL)