Trying to get the data into the right fields

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Trying to get the data into the right fields

Post by jalz » Sat Jun 29, 2013 3:28 pm

Hi Guys,I need some help again please.

I'v got the following code below which seems to be working in getting the information. The line where I put tTheData["customer"] into field "customer_name" seems to be failing. Its not putting anything into the field. If I change that line to put tTheData into field "customer_name" - then it puts the entire retrieved data into that field which is what Im expecting.
I'd like to just put the returned data into the correct fields, so customer should go in the customer_name field, customerID should go into the customer_id field etc.

Many thanks as always
Jalz


command CustomerForm pCustomerID
local tTheSQLQuery, tTheData

if (gConnID > 0) then
put "SELECT customerID,customer,address1 FROM customer WHERE customerID=" && pCustomerID into tTheSQLQuery
put revDataFromQuery(tab, cr, gConnID, tTheSQLQuery) into tTheData

if tTheData begins with "revdberr," then
delete item 1 of tTheData
else
answer tTheData
put tTheData["customer"] into field "customer_name"
end if
end if
end CustomerForm

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Trying to get the data into the right fields

Post by Dixie » Sat Jun 29, 2013 3:50 pm

This should do it...

Code: Select all

 set ItemDel to tab
put item 1 of tTheData into fld "customer_ID"
put item 2 of tTheData into fld "customer_name"

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Trying to get the data into the right fields

Post by jalz » Sat Jun 29, 2013 9:20 pm

Thank you! Yes that does it, its another way of doing it that I would never of used or guessed

Post Reply