Populating Datagrids?

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
boogerbrain
Posts: 2
Joined: Mon Nov 23, 2015 5:50 pm

Populating Datagrids?

Post by boogerbrain » Mon Nov 23, 2015 5:58 pm

I need to get a text file into a datagrid and for it to display the data in three columns: the student name, student gender, and a yes or no. Please help me this is due tomorrow

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Populating Datagrids?

Post by FourthWorld » Mon Nov 23, 2015 6:00 pm

What does the data look like? If it's tab-delimited you can probably just set the dgText property:
http://lessons.livecode.com/m/datagrid/ ... -with-data
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Populating Datagrids?

Post by dunbarx » Mon Nov 23, 2015 7:08 pm

Hi.

What Richard said. If it is not tab and return delimited, ask again quickly, since you must format it that way before you can use the one-liner he suggested.

Craig Newman

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: Populating Datagrids?

Post by quailcreek » Mon Nov 23, 2015 11:08 pm

Here's something to help you along. You don't need to set the itemDel unless you're going to refer to the parts of tData as items.

Code: Select all

put fld “FldName” into tData

set the itemDel to tab

put "Name"  & tab & “Gender” & tab & “Answer” & cr into TheTextData
set the dgText [true] of grp "YourDataGrid" to TheTextData & tData
Tom
MacBook Pro OS Mojave 10.14

Post Reply