I have a stack with five cards. I want to use fields from the first card in a calculation on the second card but
for some reason it does not recognize the field name in my code on the second card.
How do u use a field from one card in code on the next card?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: How do u use a field from one card in code on the next c
Code: Select all
put fld "myCard1" into fld "myCard2" of cd 2Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: How do u use a field from one card in code on the next c
Simon's code will work from card one to "pre-fill" a field on card two.
If you want to refer to a field on another card you can easily do it by adding it's parentage in the hierarchy. As Simon does by saying he wants the data from the first field to go into a field on card 2.
So while in the script on card 2 you can pull the data from another cardYou can even get it from another stack, if you wish
If you want to refer to a field on another card you can easily do it by adding it's parentage in the hierarchy. As Simon does by saying he wants the data from the first field to go into a field on card 2.
So while in the script on card 2 you can pull the data from another card
Code: Select all
put field "fieldOne" of card "cardOne" into field "fieldTwo"Code: Select all
put field "fieldOne" of card "cardOne" of stack "theOtherStack" into field "fieldTwo"Re: How do u use a field from one card in code on the next c
What everyone said.
When you: put foo into fld 2, you are really taking a shortcut. It should be: put foo into fld 2 of cd "cardDescriptor" of stack "stackDescriptor". When the card is the current card and the stack is the current stack, you can omit the full referencing of these objects.
Any card on any open stack, and all its resident objects, are accessible at any time. You can move data (or objects) from where you are to anywhere else, and vice-versa. You just have to specify the path. The "shortcuts" I mentioned are often taken for granted, and lead to a false sense of insecurity, hiding the flexibility that LC offers in this sort of transaction. This often trips new users.
Craig Newman
When you: put foo into fld 2, you are really taking a shortcut. It should be: put foo into fld 2 of cd "cardDescriptor" of stack "stackDescriptor". When the card is the current card and the stack is the current stack, you can omit the full referencing of these objects.
Any card on any open stack, and all its resident objects, are accessible at any time. You can move data (or objects) from where you are to anywhere else, and vice-versa. You just have to specify the path. The "shortcuts" I mentioned are often taken for granted, and lead to a false sense of insecurity, hiding the flexibility that LC offers in this sort of transaction. This often trips new users.
Craig Newman
Re: How do u use a field from one card in code on the next c
That was all very helpful thankyou
