Data Persistence

Sannyasin Brahmanathaswami brahma at hindu.org
Fri Jul 27 14:35:21 EDT 2018


Welcome John!

You will need this, I would endorse Tom's arrayEncode.  

If you have not: Learn to array code RIGHT NOW, before going further with Livecode. I resisted array for years, and it bought me a boat load of silly coding of text files. And 100 of lines of unnecessary code.... then I  are learned about arrays. I broke my head of the desk.. saying "oh wow is me!.... I have could have saved thousand of hours and lines of codes if use arrays from the beginning!" (ha)

  (rough draft code)


Local sTempParamArray # may good to save a local, 

Command saveTempParams

		Put fld "fuelNeed" into  pTempParamArray["fuelNeeded'} 
		Put fld "timeToArrival" into  pTempParamArray["timeToArrival""
		# etc.
		Put pTempParamArray into sTempParamArray
		storeTempParams pTempParamArray

End saveTempParams

command storeTempParams pTempParamArray 

	put   specialFolderPath("documents") & "/tempSavedParams" into  tSavedPath
	put sTempParamArray into url ("binfile:" & tSavedPath)

end storeTempParams

# you will have some trigger get them back, I don't know what that would be:

Function getTempSavedParams

	Put   specialFolderPath("documents") & "/tempSavedParams" into  tSavedPath
	put url ("binfile:" & tSavedPath) into pTempParamArray
	put pTempParamArray into sTempParamArray
	return pTempParamArray

end getTempSavedParams

command reLoadSettings

 	put getTempSavesParams() into pLastParams
	put pLastParams["fuelNeeded"] into # whatever
	put pLastParams["timeToArrival"] into # whatever
	# etc.

End reLoadSettings

# code is a little verbose but easy to debug later.
# other wizards can improve on my baby xTalk
 
BR 

On 7/23/18, 11:57 AM, "use-livecode on behalf of John McKenzie via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:

    What I need help with is the issue of persistence. 



More information about the use-livecode mailing list