Storing datasource in preference file

Hello all,

I’m looking to store a datasource in a preference file. Can anyone supply any info or help me out. Do I need to loop through the datasource or define it a certain why to store it in a plist file. Also do you still need to register the user defaults?

Thank you!

OK, does anyone know how to log datasource content? Anything to get me going here.

Thank you!

I have figured out how to write the data source to the preference file:


on writeSettings(serverDataSource)
	--writes datasource to com.appName.plist current users/library/Preferences directory
	log "start writeSettings"
	set allDataRows to contents of every data cell of data row of serverDataSource
	set i to 1
	repeat with curRow in allDataRows
		--set property array variable as dataRow1, dataRow2, dataRow3...etc.
		set curDataRow to "dataRow" & i
		
		--creates property array variable entery in plist
		make new default entry at end of default entries of user defaults with properties {name:curDataRow, contents:curDataRow}
		
		--adds serverCell and ipCell to dataRow# property array
		set contents of default entry curDataRow of user defaults to (items of curRow)
		
		--adds 1 to curDataRow counter
		set i to i + 1
	end repeat
	log "end writeSettings"
end writeSettings


This function will create the following in your plist:
Property Array entry as dataRow1 containing all of your data cells as strings of the currentRow of your data source
Property Array entry as dataRow2…etc.
Property Array entry as dataRow3…etc.

I am now stuck on trying to get the data back into my data source from the preference file. Any help would be greatly appreciated, please see my writeSettings function above.

Thank you very much!