Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
Need some advice. I've got a datagrid (table) called dg_charge_rate and I'd like to update a specific row. Previously the way handled it was by deleting the row and then adding a new row with the old ID. The drawback of this method was that the new item would be added to the end of the row. I've been reading up on the datagrid api and I think SetDataOfLine should allow me to update the row. I've included my code below, anyone point me where I'm going wrong with that particular line?
put fld "fld_charge_description" into theDataA["charge_description"]
put fld "fld_charge_rate" into theDataA["charge_rate"]
put the label of btn "cb_chargeable" into theDataA["chargeable"]
put fld "fld_charge_rate_lineno" into theDataA["chargeID"]
put fld "fld_charge_rate_lineno" into tLineNo
if tLineNo is an integer then
--send "DeleteLine tLineNo" to group "dg_charge_rates"
dispatch SetDataOfLine to grp "dg_charge_rates" with tLineNo, theDataA
else
dispatch "AddData" to group "dg_charge_rates" with theDataA
end if
-- refresh the datagrid
dispatch "RefreshIndex" to group "dg_charge_rates" with the dgHilitedIndex of group "dg_charge_rates"
@sritcp putting quotes around the command didn't work. However, that sample file you posted bangkok was excellent - it showed me how to deal with and manipulate data in the datagrid.