Hi Folks,
I've been trying to find this in the docs and tutorials, without success, so I'm hoping someone here can help.
I a stack with several cards, let's call them card1 and card2. While in card2 I need to get the value of a field
in card1 and put it into a container in the current card, i.e. card2. I know I can do a goto card "card2", but
am hoping to find how to do this without having to "go" there. I've tried the following without any luck:
put text from field "Field 1" of card "Card1" into myContainer
get text from field "Field 1" of card "Card1" and put it into myContainer
Any help, pointer to documentation,etc. would be much appreciated.
Thaks,
Daryl
Get data from field in card1 and put into var in card2
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Get data from field in card1 and put into var in card2
Hi.
You have the feel of LC syntax, but not quite the syntax itself.
No "from". Use "of".
Look up "of" and "in" in the dictionary. Sometimes redundant keywords are allowed, (as "in" and "of"). But not "from".
Craig Newman
You have the feel of LC syntax, but not quite the syntax itself.
No "from". Use "of".
Look up "of" and "in" in the dictionary. Sometimes redundant keywords are allowed, (as "in" and "of"). But not "from".
Craig Newman
Last edited by dunbarx on Fri Jun 07, 2013 10:52 pm, edited 1 time in total.
Re: Get data from field in card1 and put into var in card2
put the field "fieldname" of the card "mycard" into the field "fieldname2"of the card "second card"
this should work.
this should work.
Founder & Developer @ MakeShyft R.D.A - https://www.makeshyft.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com
Build Software with AppStarterStack for Livecode - https://www.AppStarterStack.com
Save Time with The Time Saver's Toolbox - https://www.TimeSaversToolbox.com
Re: Get data from field in card1 and put into var in card2
Makeshyft.
I think too many "the's":
put the field "fieldname" of the card "mycard" into the field "fieldname2"of the card "second card"
really ought to just be:
put field "fieldName" of card "myCard" into field "fieldName2" of card "secondCard" --never mind "field" to "fld" and "card" to "cd"
There was an important thread recently about the looseness of keyword use in LC. This is a holdover from the Hypercard legacy. The keyword "the" itself was the issue, mainly as it related to references to properties and especially custom properties. I feel the keyword "the" should only be used with properties (it is required for custom ones), function calls without parentheses, and never anywhere else. In this script it is merely superfluous. It can get you in trouble, however.
Craig Newman
I think too many "the's":
put the field "fieldname" of the card "mycard" into the field "fieldname2"of the card "second card"
really ought to just be:
put field "fieldName" of card "myCard" into field "fieldName2" of card "secondCard" --never mind "field" to "fld" and "card" to "cd"
There was an important thread recently about the looseness of keyword use in LC. This is a holdover from the Hypercard legacy. The keyword "the" itself was the issue, mainly as it related to references to properties and especially custom properties. I feel the keyword "the" should only be used with properties (it is required for custom ones), function calls without parentheses, and never anywhere else. In this script it is merely superfluous. It can get you in trouble, however.
Craig Newman
Last edited by dunbarx on Fri Jun 07, 2013 11:09 pm, edited 1 time in total.
Re: Get data from field in card1 and put into var in card2
Thanks guys,
Both suggestions worked! Much appreciated. I tried both:
put the field "Field1" of the card "Card1" into myContainer
put the text of field "Field1" of card "Card1" into myContainer
and ended up using the second form as it seemed the most expressive, even if a tad longer.
Regards,
Daryl
Both suggestions worked! Much appreciated. I tried both:
put the field "Field1" of the card "Card1" into myContainer
put the text of field "Field1" of card "Card1" into myContainer
and ended up using the second form as it seemed the most expressive, even if a tad longer.
Regards,
Daryl