line delimited list

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

Post Reply
link76
Posts: 99
Joined: Fri Nov 04, 2011 1:52 pm

line delimited list

Post by link76 » Wed Sep 03, 2014 9:53 am

Hello,

I would like to see the line delimited list of columns in my FORM dg ...? :roll:

thx

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: line delimited list

Post by Klaus » Wed Sep 03, 2014 5:35 pm

Hi link76,

you need to loop through the datgrid array!

Something like this, I use only three columns in my example,
you need to use of course the names of YOUR columns in the datagrid! 8)

Code: Select all

on mouseUp
   ## Get the datagrid data, which is an array:
   put the dgdata of grp "your datagrid here" into tData
   
   ## We use the KEYS of that array (1 to N), which is a CR delimited list, for the following loop
   put the keys of tData into tKeys
   
   ## we use tis variable for the text list:
   put empty into tTextList
   
   ## here we create a simple (test) TAB and CR delimited list from the array data
   repeat for each line tKey in tKeys
      put tData[tKey]["column 1"] & TAB & tData[tKey]["column 2"] & TAB & tData[tKey]["column 3"] & CR after tTextList
   end repeat
   
   ## get rid of trailing CR
   delete char -1 of tTextList
   
   ## Now display list in a field
   put tTextList into fld "whatever"
   
end mouseUp
Hint:
If one of your columns contains MULTILINE text, this will of course "break" the list a bit 8)


Best

Klaus

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am
Location: Warszawa / Poland

Re: line delimited list

Post by snm » Wed Sep 03, 2014 9:48 pm

put the dgText of grp "DataGrid" into fld "Field"
should work for any count of columns.

Marek

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: line delimited list

Post by Klaus » Wed Sep 03, 2014 10:10 pm

"dgtext" does really work with a FORM datagrid? :shock:

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am
Location: Warszawa / Poland

Re: line delimited list

Post by snm » Thu Sep 04, 2014 6:32 am

Why not? I didn't use FORM yet, but didn't find any info it should not work.
By the way, are there columns in DataGrid FORM?

Marek

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: line delimited list

Post by Klaus » Thu Sep 04, 2014 12:41 pm

Hi Marek,

hmmm, true! :D

I think that I always associate a datagrid of type TABLE with ONE-line data and a datagrid
of type FORM with MULTI-line data, where a TAB and CR delimited list will not make much sense.
But obviously we can also use dgtext with FORMs, too.

@link76
So just try:
...
put the dgtext of grp "your FORM datagrid here..." into fld "the field with some TABstops in it"
...
:D


Best

Klaus

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am
Location: Warszawa / Poland

Re: line delimited list

Post by snm » Thu Sep 04, 2014 1:01 pm

So 1 small beer for me :P

Marek

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: line delimited list

Post by Klaus » Thu Sep 04, 2014 1:07 pm

YES! :D

I was very surprised that in bars in Portugal they really sell "um fino", which is a 0.1 liter glass of beer!
Still wondering what that's good for :D

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am
Location: Warszawa / Poland

Re: line delimited list

Post by snm » Thu Sep 04, 2014 1:14 pm

In our country small beer is min. 0,33 l :oops:

Marek

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: line delimited list

Post by Klaus » Thu Sep 04, 2014 1:20 pm

Hi Marek,

you are czech, right?
Well, that is no wonder, it is the country of origin of all the beer in the world :D


Best

Klaus

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am
Location: Warszawa / Poland

Re: line delimited list

Post by snm » Thu Sep 04, 2014 2:33 pm

50% / 50% :D
Czech beer is known on all over the word.
I'm from Poland. We have also our own good beer.

Marek

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: line delimited list

Post by Klaus » Thu Sep 04, 2014 3:19 pm

Oh, sorry, but I was quite near :D

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am
Location: Warszawa / Poland

Re: line delimited list

Post by snm » Thu Sep 04, 2014 4:31 pm

Yes, for me only about 450 km to boarder / 8-9 hours of drive (terrible roads and a lot of police radars). But we can drink this beer in Germany - the same 450 km to the boarder, but new speedway only 4 hours. :wink:

Marek

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”