Page 1 of 1

Data grid form - problem editing data [solved]

Posted: Thu Sep 28, 2017 11:48 am
by ittarter
Hello,

I'm trying to enter and save data in a data grid form using the field editor.

I followed the instructions in the dictionary. I'm using an array with three keys as my dgData and the data displays correctly.

However the code below (which is found in the row template script of the data grid) is malfunctioning and I don't know why.

After line 4, the handler self-aborts. I can put additional lines of code after line 4, e.g. put 1 into y, add a breakpoint, and the breakpoint isn't hit.

Code: Select all

on CloseFieldEditor pFieldEditor
put the dgIndex of me into theIndex
put the dgDataOfIndex[theIndex] of the dgControl of me into theDataA
put the text of pFieldEditor into theDataA[theIndex] of me --breakpoints after this line aren't hit... why??
set the dgDataOfIndex[theIndex] of the dgControl of me to theDataA --can't get to this line of script, so the new data can't be saved...
end CloseFieldEditor
theDataA has the correct array stored, with the values of the highlighted line of the data grid, as well as the new value, all with the correct keys.

Any insight into this unexpected behavior would be appreciated, or possibly another way to accomplish the same task.

Re: Data grid form - problem editing data

Posted: Thu Sep 28, 2017 6:28 pm
by sritcp
Hi ittarter:

Shouldn't line 4 be

Code: Select all

put the text of pFieldEditor into theDataA
theDataA is an array containing one row of dgData[theIndex].
So, theDataA[theIndex] would point to empty, halting your handler.

Regards,
Sri

Re: Data grid form - problem editing data

Posted: Fri Sep 29, 2017 12:27 pm
by ittarter
sritcp wrote:Hi ittarter:

Shouldn't line 4 be

Code: Select all

put the text of pFieldEditor into theDataA
theDataA is an array containing one row of dgData[theIndex].
So, theDataA[theIndex] would point to empty, halting your handler.

Regards,
Sri
Thanks for your help, Sri.

That code didn't work (it would empty dgData completely!), but it gave me some insight into what the code was doing. I finally got it to work by specifying my key.
on CloseFieldEditor pFieldEditor
put the dgIndex of me into theIndex
put the dgDataOfIndex[theIndex] of the dgControl of me into theDataA
put the text of pFieldEditor into theDataA["Score"]
end CloseFieldEditor