* Gendetail and gendetailB are identical and each has unique idetailids
CREATE SQL VIEW v_test as ;
select idetailid,cheaderid from gendetail ;
where cheaderid = ?P_cheaderid;
union all ;
select idetailid,cheaderid from gendetailb;
where cheaderid = ?P_cheaderid
DBSetProp('V_test', 'View', 'UpdateType', 1)
DBSetProp('V_test', 'View', 'WhereType', 3)
DBSetProp('V_test', 'View', 'FetchMemo', .T.)
DBSetProp('V_test', 'View', 'SendUpdates', .T.)
DBSetProp('V_test', 'View', 'Tables', 'icams_gendetail')
DBSetProp('V_test.idetailid', 'Field', 'KeyField', .T.)
DBSetProp('V_test.idetailid', 'Field', 'Updatable', .F.)
DBSetProp('V_test.idetailid', 'Field', 'UpdateName', 'icams!gendetail.idetailid')
DBSetProp('V_test.idetailid', 'Field', 'DataType', "I")
DBSetProp('V_test.cbasedon', 'Field', 'KeyField', .F.)
DBSetProp('V_test.cbasedon', 'Field', 'Updatable', .T.)
DBSetProp('V_test.cbasedon', 'Field', 'UpdateName', 'icams!gendetail.cbasedon')
DBSetProp('V_test.cbasedon', 'Field', 'DataType', "C")
when I use v_test and change values, tableupdate(), requery() shows the original values.
Thanks!
>>Can Fox Update views that are UNIONed???
>>If so, how?
>>
>>Thanks!!!!
>
>It depends on a number of factors.
>
>1. Did you union queries from different tables or did you simply need two different filter expressions for the same table?
>2. Did you concatenate the field lists of both tables (each field from both tables is unique in the result set) or did you use the same field names for different fields (table1.field1 and table2.field2 combine into resultset.field3)?
>
>Take the following example:
>Table 1
>Field1 Field2
>1 John
>2 Joe
>3 Jim
>
>Table2
>Field1 Field2
>1 Baseball
>2 Tennis
>3 Croquet
>
>Result Set 1
>select t1.field1, t1.field2, 0 as field3, space(8) as field4
> from table1 t1
>union
>select 0 as field1, space(8) as field2, t2.field1 as field3, t2.field2 as field4
> from table1 t2
>
>Field1 Field2 Field3 Field4
>1 John 0
>2 Joe 0
>3 Jim 0
>0 1 Baseball
>0 2 Tennis
>0 3 Croquet
>
>Result Set 2
>select t1.field1, t1.field2
> from table1 t1
>union
>select t2.field1, t2.field2
> from table1 t2
>
>Field1 Field2
>1 John
>2 Joe
>3 Jim
>1 Baseball
>2 Tennis
>3 Croquet
>Changes in result set 1 can be sent to the backend. Field1 and Field3 would need to be configured as key values. Changes in result set 2 can not. There is no way of telliong which table each row comes from.
>
>If you post your union statement, a more definitive answer may be available.
>
>HTH.