Saving Data from a DataSet when an outer join is used

Posted by kopfb on 17-Sep-2010 12:57

Trying to wrap my mind around this. So I have dataset that is populated from two tables using an outer-join. I.e

hQuery:QUERY-PREPARE("PRESELECT EACH Table1 NO-LOCK,FIRST Table2 NO-LOCK WHERE " +
                     "Table2.field1 = Table1.field1 outer-join").

This in turn is used to populate an UltraGrid. The fields in the grid are updateable from Table1 as is one field from Table2. Running a SaveData procedure using Save-Row-Changes for any row-state of 1,2 or 3 works fine except for saving any change to Table2.field1. How can I also save the change to Table2.field1 as it will only will save the changes to Table1.fields? I know I am missing something here but whatever it seems like it should be obvious but I can't seem to figure it out.

Thanks in advance,

Brad

OE 10.2B

All Replies

Posted by Håvard Danielsen on 20-Sep-2010 08:36

kopfb wrote:

Trying to wrap my mind around this. So I have dataset that is populated from two tables using an outer-join. I.e

hQuery:QUERY-PREPARE("PRESELECT EACH Table1 NO-LOCK,FIRST Table2 NO-LOCK WHERE " +
                     "Table2.field1 = Table1.field1 outer-join").

This in turn is used to populate an UltraGrid. The fields in the grid are updateable from Table1 as is one field from Table2. Running a SaveData procedure using Save-Row-Changes for any row-state of 1,2 or 3 works fine except for saving any change to Table2.field1. How can I also save the change to Table2.field1 as it will only will save the changes to Table1.fields? I know I am missing something here but whatever it seems like it should be obvious but I can't seem to figure it out.

Thanks in advance,

Brad

OE 10.2B

save-row-changes has optional parameters that allow you to specify which table in the data-source you want to update.

So you can do:

    mybuffer:save-row-changes(). /* 1st is default */

    mybuffer:save-row-changes("table2").

I do not know how this behaves if the outer-joined record is not there or if the rowstate is create or delete.

Posted by kopfb on 20-Sep-2010 12:58

Thanks! That has gotten me down the right path.

This thread is closed