Page 1 of 1

Want top pass values from one card to another

Posted: Thu Jan 23, 2014 6:55 am
by monikadhingra
Hi,
I want to pass values from one card to another ,both card are under same stack.
in my first card i am taking line number and according to that fetching value,value is a html,plz chi below
In my first card :
put "item_" & word 2 of the selectedLine of me into theLine
put the customproperties[theLine] of this stack into theItem


Now i want to use this fetched value in my next card but unable to do by using global variable.

Re: WANT TO PASS VALUES FROM ONE CARD TO ANOTHER

Posted: Thu Jan 23, 2014 7:08 am
by endernafi
Monika hi,

There are many ways to do this, using a global is the least preferable one.
I'll write two of them on top of my head.
1.
Use a custom property.
Script for card 1:

Code: Select all

on fetchData
   put "item_" & word 2 of the selectedLine of me into theLine
   put the customProperties[theLine] of this stack into theItem

   set the cPassingParam of card 2 to theItem
end fetchData
Script for card 2:

Code: Select all

on doThing
   put the cPassingParam of me into tParam
   if tParam is not empty then...
end doThing
2.
Using getter - setter method.
Script for card 1:

Code: Select all

on fetchData
   put "item_" & word 2 of the selectedLine of me into theLine
   put the customProperties[theLine] of this stack into theItem

   send "writeParams theItem" to card 2 in 1 milliseconds
end fetchData
Script for card 2:

Code: Select all

local sPassingParam

on writeParams tParam
   put tParam into sPassingParam
end writeParams

on doThing
   if sPassingParam is not empty then...
end doThing
Edit:
Btw, if you still wanna use global variables, you should know that you have to define them in each script where you want to use them.
Script for card 1:

Code: Select all

global gPassingParam

on fetchData
   put "item_" & word 2 of the selectedLine of me into theLine
   put the customProperties[theLine] of this stack into theItem

   put theItem into gPassingParam
end fetchData
Script for card 2:

Code: Select all

global gPassingParam

on doThing
   if gPassingParam is not empty then...
end doThing
Hope it helps...

Best,

~ Ender Nafi

Re: WANT TO PASS VALUES FROM ONE CARD TO ANOTHER

Posted: Thu Jan 23, 2014 7:28 am
by monikadhingra
thanks 1st method working fine.

Re: Want top pass values from one card to another

Posted: Fri Jan 24, 2014 8:24 am
by monikadhingra
Hi Ender are you abel to help me in order to show image from url on card?