Help With Datagrids needed!

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
titan923
Posts: 1
Joined: Wed May 08, 2013 6:31 pm

Help With Datagrids needed!

Post by titan923 » Wed May 08, 2013 6:42 pm

Hey!

Atm, what my code does is put a list of names in a datagrid column but puts "Student Names" in between. I know this is probably due to "Student Names" being in the repeat structure, but i don't know how else it would work? I may be misusing the Array as well, so any help at all would be beneficial.

Code: Select all

  

 repeat with x=1 to the number of lines in field "RegisterList"
      
      put  "Student Names" & cr &\
      Line x of field "RegisterList" into tDgArray[x]
        
   end repeat
   
   combine tDgArray using return
   put tDgArray into theText

   put true into firstLineContainsColumnNames
   set the dgText [ firstLineContainsColumnNames ] of group "Register Group" to theText

Thanks!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Help With Datagrids needed!

Post by Klaus » Thu May 09, 2013 11:55 am

Hi titan923,

welcome to the forum! :)

Yep, you are producing a string like this:
Student Names
content of line 1 of the field
Student Names
content of line 2 of the field
Student Names
content of line 3 of the field
etc...

You could simply, no need to mess around with an array here:
...
put "Student Names" & CR & field "RegisterList" into theText
set the dgText [TRUE] of group "Register Group" to theText
...
:D

Best

Klaus

Post Reply