Search Values of Array in "One Go"

Bob Sneidar bobsneidar at iotecdigital.com
Thu Aug 24 15:03:18 EDT 2017


I've partially deciphered it. I created a tab delimited table of each non-printing character followed by the text between that and the next non-printing character. Here is a sample:

12	contactphone
8	
0	
12	661-257-1177
0	
13	contactonsite
8	
0	
5	false
0	
12	contactemail
7	
0	
6	itname
7	
0	

The 12 before the contactphone and the 5 before the false are clearly the length of the value. 0 is some kind of delimiter. 8 following contactphone and contactonsite appears to mean "what follows is a value" (also preceded by a length) and 7 means "empty". 

What is clear before going any further is that a key cannot be discerned from this format. At least not very easily. 

Now I wrote a function years ago similar to printKeys() but specifically designed so that filter could be used on the result. It produces a comma delimited list, each item of which is a tab separated value of the array key and the value. It looks like this:

[1] ["addr2"] 	,[1] ["smtppassword"] 	none,[1] ["itemail"] 	,[1] ["contactphone"] 	661-257-1177,[1] ["contactonsite"] 	false, etc. 

You can see from this format that you can convert to lines and then you can filter the lines by key or by value. If you want by key you could filter by quote & key & quote. Otherwise for values filter by tab & value. 

The downside would be working with really large arrays because of course this loops through every array element to produce a textual representation of the array. Still, it's something if you already have an array for one reason or another, and you want to search/filter the array for keys or values. 

Bob S






More information about the use-livecode mailing list