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!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
lemodizon
- Posts: 219
- Joined: Thu Apr 05, 2018 3:33 pm
Post
by lemodizon » Tue May 28, 2024 7:48 am
Hi everyone,
I want to get the datas from my polygrid the item 1 and item 2 and save it to my database.
[img
][/img]
I tried to run my code but it only get the data the one is highlited from my polygrid
Code: Select all
put the hilitedline of widget "pgDetails" of stack "ArtistOutputSheet" into tLine
set the itemDelimiter to tab
put line tLine of the pgText of widget "pgDetails" of stack "ArtistOutputSheet" into tData
repeat with x = 1 to the number of lines in tData
put item 1 of tData & cr into tList
end repeat
answer tList
Thank you & God Bless Everyone
Regards,
lemodizon
-
bn
- VIP Livecode Opensource Backer

- Posts: 4171
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Tue May 28, 2024 10:09 am
Hi lemodizon,
There is
tsvData for the polygrid, you can set and get
tsvData of a polygrid.
The first line is the column headers.
That is one way to get at your data, here it seems to be the easiest way.
Code: Select all
on mouseUp
put the tsvData of widget "pgDetails" into tData
set the itemDelimiter to tab
repeat with i = 1 to the number of lines of tData
put item 1 to 2 of line i of tData & return after tCollect
end repeat
delete char -1 of tCollect # a return
## I reset the itemDelimiter, not necessary here but in longer scripts
## it is easy to forget that the itemDelimiter is not comma
set the itemDelimiter to comma
## tCollect contains your result as tabbed list
put tCollect into message box
end mouseUp
Kind regards
Bernd
-
lemodizon
- Posts: 219
- Joined: Thu Apr 05, 2018 3:33 pm
Post
by lemodizon » Tue May 28, 2024 3:58 pm
bn wrote: ↑Tue May 28, 2024 10:09 am
Hi lemodizon,
There is
tsvData for the polygrid, you can set and get
tsvData of a polygrid.
The first line is the column headers.
That is one way to get at your data, here it seems to be the easiest way.
Code: Select all
on mouseUp
put the tsvData of widget "pgDetails" into tData
set the itemDelimiter to tab
repeat with i = 1 to the number of lines of tData
put item 1 to 2 of line i of tData & return after tCollect
end repeat
delete char -1 of tCollect # a return
## I reset the itemDelimiter, not necessary here but in longer scripts
## it is easy to forget that the itemDelimiter is not comma
set the itemDelimiter to comma
## tCollect contains your result as tabbed list
put tCollect into message box
end mouseUp
Kind regards
Bernd
Hi Bernd,
thanks again for helping me out
question what is the use of delete char -1? i tried to use the toggle breakpoint so that i can see if there will be changes noting change or i guess i just overlook the code.
thank you very much you help me simplified my code thanks
Thank you & God Bless Everyone
Regards,
lemodizon
-
bn
- VIP Livecode Opensource Backer

- Posts: 4171
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Tue May 28, 2024 5:07 pm
Hi lemodizon,
lemodizon wrote: ↑Tue May 28, 2024 3:58 pm
question what is the use of delete char -1? i tried to use the toggle breakpoint so that i can see if there will be changes noting change or i guess i just overlook the code.
is the return at the end of tCollect which it puts there in the last iteration.
I prefer to take it out to make the list a clean list.
Kind regards
Bernd
-
lemodizon
- Posts: 219
- Joined: Thu Apr 05, 2018 3:33 pm
Post
by lemodizon » Wed May 29, 2024 2:48 pm
hi Bernd,
thanks for the explanation.
Thank you & God Bless Everyone
Regards,
lemodizon