--_7fbce53f-74ae-46fa-b22a-02ef2b65da5f_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable



> 
> I have a question, I want to store some data in two columns, for example
> 
> 0001, stuff1 stuff2
> 0002, morestuff
> 0003, extrastuff
> 0004, more evenmore
> 
> As you can see column 1 is an ID and column 2 is one or more strings.
> 
> I want to do a search across another data set to say if column 1 (ID
> number) matches in both sets and the contents of column 2 to data set B.
> 
> I initially thought to use a hash, but it scrambles the order of the
> data so was unsure of its efficiency and use.
> 
> Any suggestions?


Since everybody else is rooting for hashes, let's talk arrays. You could use a structure like this:

mydata = [nil, [stuff1, stuff2], [morestuff], [extrastruff], [more evenmore]]

Then to search for matches, you can do:

searched1 = mydata[1] & datasetA & datasetB
searched2 = mydata[2] & datasetB

This is assuming that your datasets are arrays of course.

And it's fine if you want to use hashes to store the key as id too:

mydata ={ 1 => [stuff1, stuff2], 2 =>[morestuff], 3 => [extrastruff], 4 =>[more evenmore] }

searched1 = mydata[1] & datasetA & datasetB

searched2 = mydata[2] & datasetB
 		 	   		  
_________________________________________________________________
Lauren found her dream laptop. Find the PC that√‘ right for you.
http://www.microsoft.com/windows/choosepc/?ocid=ftp_val_wl_290-_7fbce53f-74ae-46fa-b22a-02ef2b65da5f_--