Page 1 of 1

DataGrid Table; entering more rows of data

Posted: Tue Feb 21, 2023 12:44 pm
by CAsba
Hi,
I just set up a datagrid table for customers' data, name, address, etc. There is a button that puts the data inputted by the user (new customer) into the Dg. I have one line of data - that is, one customer in the table. When I try to enter a second customer's details it just overwrites the first one. The lesson lost me inasmuch as it goes into editing the row template, but I don't need to edit to enhance the presentation as the table will never be seen, it will just issue the data to invoices, etc., according to a user-selected customer code. Can anyone advise me in simple terms how to enter a second, and successive rows into the dg ?

Re: DataGrid Table; entering more rows of data

Posted: Tue Feb 21, 2023 12:51 pm
by Klaus
Hi CAsba,
CAsba wrote:
Tue Feb 21, 2023 12:44 pm
There is a button that puts the data inputted by the user (new customer) into the Dg. I have one line of data - that is, one customer in the table. When I try to enter a second customer's details it just overwrites the first one.
the big question is, what did you script in that namely button?
Tell us and we will be able to point you to the problem.

Best

Klaus

Re: DataGrid Table; entering more rows of data

Posted: Tue Feb 21, 2023 1:06 pm
by CAsba
Hi Klaus, the code is

Code: Select all

put fld "newcode" of cd "enter new customer" & tab & fld "bizname" of cd "enter new customer" & tab & fld "line2" of cd "enter new customer" & tab & fld "line3" of cd "enter new customer" & tab & fld "line4" of cd "enter new customer" & tab & fld "line5" of cd "enter new customer" & tab & fld "line6" of cd "enter new customer" & tab & fld "line7" of cd "enter new customer" & tab & fld "line8" of cd "enter new customer" & tab & fld "line9" of cd "enter new customer" & tab & fld "line10" of cd "enter new customer" & tab & fld "line11" of cd "enter new customer" into theText
   put false into firstLineContainsColumnNames
   set the dgText [ firstLineContainsColumnNames ] of group "DataGrid 1" to theText

Re: DataGrid Table; entering more rows of data

Posted: Tue Feb 21, 2023 1:12 pm
by Klaus
AHA! :D
Well, setting "the dgtext of grp xyz to zxy" will overwrite the complete content of the datagrid and not only the last line!

You just want to:

Code: Select all

...
put fld "newcode" of cd "enter new customer" & tab & ... into theText
dispatch "addline" to grp "DataGrid 1" with theText
...
Best

Klaus

Re: DataGrid Table; entering more rows of data

Posted: Tue Feb 21, 2023 1:52 pm
by CAsba
Many thanks Klaus, worked a treat.