Does the schema modeller remove from the DFM the lines with SQLOrigin in them now? I made a small change to something in a service and when something unrelated failed I discovered lots of these lines gone and the failure seemed to be because:
It was using a manual SQL (joining a couple of tables)
In the DFM, the definition for the table being used had DatasetField, TableField and SQLOrigin all set to something. The TableField oddly was not actually to do with the specific tables in the join but was from another table. Not sure how that got there, but looking in my git, it’s been like that for a while.
It seems when SQLOrigin is present and correct, it works but when it wasn’t it looked for the unavailable TableField and that caused a failure.
I have too many to go and check if there are any other similar fields setup similarly (I have already found another couple) so just thought I’d ask if this is an expected thing for these to be removed?
property SQLOrigin: string read GetSQLOrigin write SetSQLOrigin stored StoreSQLOrigin;
...
function TDAColumnMapping.GetSQLOrigin: string;
begin
if (fSQLOrigin = '') then Result := TableField else Result := fSQLOrigin
end;
function TDAColumnMapping.StoreSQLOrigin: Boolean;
begin
Result := (fSQLOrigin <> fTableField) and (Trim(fSQLOrigin) <> '');
end;
so if it is the same as TableField, it isn’t stored.
if SQLOriginis differ from TableField and it is removed from .daSchema - this is a bug.
What happens if you edit the DFM manually so TableField for one of them is something random, but SQLOrigin is the same as the DataTableField, which is the situation I have, like so :
Yes, you also did things differently to me, but now I’ve just gone to repeat it (my way), and it did save as expected, i.e. it left the SQLOrigin in place. I’ll keep looking to find how to make it repeatable.
Incidentally, I don’t think I’ve ever used the structure/obj inspector in Delphi to modify DA things, I’ve always used the SM.
Thanks Eugene, that one does seem to work correctly. I only hadn’t tried this one as we are getting close to a software release and I don’t like to change things like this until after that!