Accessing contents of field on previous card SOLVED
Posted: Sat Jan 17, 2015 1:41 pm
Hello,
I can't seem to figure out how to do the following:
On opening the 2nd card I would like to be able to access the contents of a field on the previous card line by line:
On the first card I have this script:
What this script is doing: Each time the location changes it adds the new latitude and longitude coordinates into two separate fields thus creating a list of the latitude coordinates and a list of the longitude coordinates - both in the order in which they were visited.
The objective of the second card script is to go through the values line of the fields (on the previous card) line by line (ie setting the location of the circle to:
'line one of field latitude','line one of field longitude'
then creating another circle at:
'line two of field latitude','line two of field longitude'
and so on.. )
Because the latitude and longitude values don't match the size of the card I have used:
To remap the values to the scale of the card.
I can't seem to figure out how to do the following:
On opening the 2nd card I would like to be able to access the contents of a field on the previous card line by line:
Code: Select all
global counterVar
global allXCoords
global tList
global tMax
global tMin
global tList2
global tMax2
global tMin2
global pLatitude
global pLongitude
global pAltitude
on openCard
lock screen
repeat with itemCount = 1 to counterVar
put line itemCount of field "latitude" into xLoc
put line itemCount of field "longitude" into yLoc
put (((xLoc - tMin) * (the width of this card - 1)) / (tMax - tMin)) + 1 into xLocNew
put (((yLoc - tMin2) * (the width of this card - 1)) / (tMax2 - tMin2)) + 1 into yLocNew
create grc itemCount
set the location of grc itemCount to xLocNew,yLocNew
set the style of grc itemCount to oval
set the width of grc itemCount to 20
set the height of grc itemCount to 20
set the opaque of grc itemCount to true
end repeat
end openCard
Code: Select all
global counterVar
global allXCoords
global tList
global tMax
global tMin
global tList2
global tMax2
global tMin2
global pLatitude
global pLongitude
global pAltitude
global xLocNew
global yLocNew
on locationChanged pLatitude, pLongitude, pAltitude
put pAltitude into field "altitude"
put pLatitude & cr after field "latitude"
put pLongitude & cr after field "longitude"
put counterVar into field "counter"
add 1 to counterVar
put counterVar into field "counter"
end locationChanged pLatitude, pLongitude, pAltitude
on findMinMaxLat
put fld "Latitude" into tList
replace cr with comma in tList
put max(tList) into tMax
put min(tList) into tMin
answer "MaxX: " & tMax & cr & "MinX: " & tMin
end findMinMaxLat
on findMinMaxLon
put fld "Longitude" into tList2
replace cr with comma in tList2
put max(tList2) into tMax2
put min(tList2) into tMin2
answer "MaxY: " & tMax2 & cr & "MinY: " & tMin2
end findMinMaxLon
on errorDialog pExecutionError, pParseError
answer "An error occurred on line: " & item 2 of line 1 of pExecutionError & cr & pExecutionError
end errorDialog
The objective of the second card script is to go through the values line of the fields (on the previous card) line by line (ie setting the location of the circle to:
'line one of field latitude','line one of field longitude'
then creating another circle at:
'line two of field latitude','line two of field longitude'
and so on.. )
Because the latitude and longitude values don't match the size of the card I have used:
Code: Select all
NewValue = (((OldValue - OldMin) * (NewMax - NewMin)) / (OldMax - OldMin)) + NewMin