Putting data from fields into a datagrid

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
wolfkillshepard
Posts: 44
Joined: Tue Jul 12, 2011 7:43 pm

Putting data from fields into a datagrid

Post by wolfkillshepard » Mon Aug 15, 2011 7:13 pm

Hello, my name is Christian

On one card a user enters data into fields, example: Company Name, First Name, Last Name, and Email. After the user enters that data into said fields, the user would hit a confirm button. When the hits the confirm button I would like the information from those fields to be put into a datagrid on a separate card.

I would like the datagrid to list the info by company name. After the user clicks on one of the rows displaying the company name, I want the user to be navigated to a card that builds all the information into it. Information being Company Name, First Name, Last Name, and Email.

Thanks everyone I appreciate the help!

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

Re: Putting data from fields into a datagrid

Post by dunbarx » Mon Aug 15, 2011 7:59 pm

Hi.

Datagrids are just complex gadgets created with ordinary objects. Go here:http://lessons.runrev.com/spaces/lesson ... s/datagrid

Chack out the dgText and dgData.

Craig Newman

wolfkillshepard
Posts: 44
Joined: Tue Jul 12, 2011 7:43 pm

Re: Putting data from fields into a datagrid

Post by wolfkillshepard » Mon Aug 15, 2011 8:03 pm

I'm reading through and I am having trouble grasping the concept of datagrids though the page, there's just a lot of info there.

And examples or sample code would be greatly appreciated

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

Re: Putting data from fields into a datagrid

Post by dunbarx » Mon Aug 15, 2011 9:32 pm

On a clean card, drag a new datagrid. Go to the property inspector, name it "dg1" and create a three columns. Now make a button. In the button script place:

Code: Select all

on mouseUp
   put "name" & tab & "company" & tab & "address" & return & "name2" & tab & "company2" & tab & "name2" into temp
   set the dgText of group "dg1" to temp
end mouseUp
In this simple example, it can be seen that the datagrid accepts data that is tab and return delimited. You should be able to empty the datagrid and should also be able to modify the code so that you can do whatever you need to. But write back as often as you want...

Craig Newman

wolfkillshepard
Posts: 44
Joined: Tue Jul 12, 2011 7:43 pm

Re: Putting data from fields into a datagrid

Post by wolfkillshepard » Mon Aug 15, 2011 10:11 pm

Thanks for the help, that clears up a lot.

I have a couple more questions

Could I make it so that when I click a individual row in the data grid it will take me to a new card and populate fields in it based on the data that one row contains?

What would the code look like specifying one row out of a whole datagrid?

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Putting data from fields into a datagrid

Post by BarrySumpter » Tue Aug 16, 2011 8:35 am

Not tested by me as yet:


How-Do-I-Get-Data-Associated-With-a-Row-or-Column-
http://lessons.runrev.com/spaces/lesson ... or-Column-
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

Post Reply