Latest SM issue with SQLOrigin

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:

  1. It was using a manual SQL (joining a couple of tables)
  2. 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.
  3. 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?


What build of DA are you using?

we have

   property SQLOrigin: string read GetSQLOrigin write SetSQLOrigin stored StoreSQLOrigin;
function TDAColumnMapping.GetSQLOrigin: string;
  if (fSQLOrigin = '') then Result := TableField else Result := fSQLOrigin

function TDAColumnMapping.StoreSQLOrigin: Boolean;
  Result := (fSQLOrigin <> fTableField) and (Trim(fSQLOrigin) <> '');

so if it is the same as TableField, it isn’t stored.

if SQLOrigin is differ from TableField and it is removed from .daSchema - this is a bug.

edit: seems DASM saved schema correctly:

Then it’s a bug, they are different. I’m using .1585. I can try with .1587 if it helps.


can you post simple testcase to support@, pls?

I’ll see if I can build a test case.

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 :

            DatasetField = 'sum_open_value'
            TableField = 'HouseIndex'
            SQLOrigin = 'sum_open_value'

Then make a change and save it.
Note I can replace the HouseIndex with sum_open_value and it then works (the SQLOrigin is fine to be removed now)


works as expected:


OK, I have done this, using the DAServer project.
Edited the DFM to change the client discount field to match how my project is:


Looking in SM:

Now close it SM without changing something, and it works. Make SM think something’s changed to force the save, and it gets removed:

(edited as posted wrong image!)

Curious. I’ll investigate more. There’s clearly more to it.


in my video I’ve changed statement name so Schema Modeller has to re-save .daSchema …

edit: I can reproduce original issue if schema uses old v3 (xml) format.
investigate this case …

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.

Ah, interesting, can I find this some place? Mine is certainly old (started this one with DA version 1 !) but I do update things as I need to.


.1587 should solve your original issue.
since this version, DAD saves .daSchema in json (v4) format when it is passed to Schema Modeller.

in .1585 - xml (v3) format was used and it causes that issue

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!

Logged as bugs://D19457.

bugs://D19457 was closed as fixed.