General information
Category:
Coding, syntax & commands
>>I am trying to create a grid, using a view that is already created. I created the view programmatically in a command button. When clicking on the command I would like a grid to pop-up containing the data from the view. I have looked at page 68 in the Developers Guide(Defining a Grid Control) and have made no progress.
>
>You could create Grid in Form Designer with .Visible=.f. . CommandButton.Click() will include:
>Thisform.Grid.RecordSource="viewalias"
>Thisform.Grid.Visible=.t.
>
>>Also, when making a view updatable . Why do you have to specify a unique key in the base table you are updating and in the view. My keyfields are location number and customer number. I can update a fields but, changes are made to all records have the same customer number.
>
>Unique key is necessary when view data going back to source (tableupdate()), else VFP doesn't know what rows should be updated.
This is the code that I am using for the to create this view. I have all fields that I need to update defined as updatable. My Keyfields are effective date, location number, customer number on the view. On the base table my keyfields are location number, customer number and location + customer number. Since I have the effective data on the view, I am lead to think that I just defined a unique key. Like I said it will update but updates all the records with that customer number even if the location number is different.
set safety off
create sql view test;
as SELECT Custrate.locno, Custrate.custno, Custrate.effdate,;
Custrate.tapumfee, Custrate.taamdfee, Custrate.tabilfee,;
Custrate.ta3ptyfee, Custrate.drppumfee, Custrate.drpadmfee,;
Custrate.drpbilfee, Custrate.drp3ptyfee, Custrate.tabill,;
Custmast.tacustno;
FROM pathway!custrate RIGHT OUTER JOIN pathway!custmast ;
ON Custrate.custno = Custmast.custno;
where custmast.tacustno = ?'enter customer number'
dbsetprop('test', 'view', 'tables', 'custrate')
dbsetprop('test.effdate', 'field', 'updatename', 'custrate.effdate')
dbsetprop('test.tapumfee', 'field', 'updatename', 'custrate.tapumfee')
dbsetprop('test.taamdfee', 'field', 'updatename', 'custrate.taamdfee')
dbsetprop('test.tabilfee', 'field', 'updatename', 'custrate.tabilfee')
dbsetprop('test.ta3ptyfee', 'field', 'updatename', 'custrate.ta3ptyfee')
dbsetprop('test.drppumfee', 'field', 'updatename', 'custrate.drppumfee')
dbsetprop('test.drpadmfee', 'field', 'updatename', 'custrate.drpadmfee')
dbsetprop('test.drpbilfee', 'field', 'updatename', 'custrate.drpbilfee')
dbsetprop('test.drp3ptyfee', 'field', 'updatename', 'custrate.drp3ptyfee')
dbsetprop('test.tabill', 'field', 'updatename', 'custrate.tabill')
dbsetprop('test.custno', 'field', 'keyfield', .t.)
dbsetprop('test.locno', 'field', 'keyfield', .t.)
dbsetprop('test.effdate', 'field', 'keyfield', .t.)
*!* dbsetprop('test.tapumfee', 'field', 'keyfield', .t.)
dbsetprop('test.tapumfee', 'field', 'updatable', .t.)
dbsetprop('test.effdate', 'field', 'updatable', .t.)
dbsetprop('test.taamdfee', 'field', 'updatable', .t.)
dbsetprop('test.tabilfee', 'field', 'updatable', .t.)
dbsetprop('test.ta3ptyfee', 'field', 'updatable', .t.)
dbsetprop('test.drppumfee', 'field', 'updatable', .t.)
dbsetprop('test.drpadmfee', 'field', 'updatable', .t.)
dbsetprop('test.drpbilfee', 'field', 'updatable', .t.)
dbsetprop('test.drp3ptyfee', 'field', 'updatable', .t.)
dbsetprop('test.tabill', 'field', 'updatable', .t.)
dbsetprop('test', 'view', 'sendupdates', .t.)
use test
tableupdate()
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only