Page 1 of 1

Help With Datagrids needed!

Posted: Wed May 08, 2013 6:42 pm
by titan923
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!

Re: Help With Datagrids needed!

Posted: Thu May 09, 2013 11:55 am
by Klaus
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