Skip navigation
Currently Being Moderated

ArrayCollection all items in string

Jan 2, 2013 9:59 AM

I'm trying to find all vehicles that have a string of accessories.

 

I have a comma sep string of optioncodes that represent selectedItems from an options List

optionsString:String = leather,stripes, ...

 

I have an ArrayCollection called vehicleOptions that contains a list of vehicle options one row per option

VIN1,optioncode

VIN1,optioncode

VIN2,optioncode

VIN2,optioncode

VIN3,optioncode

...

 

I need to retrieve all vehicles (VINs) that have, not one, but ALL of the optioncodes contained in the selected optioncodes string. 

 

Any recommendations on how to do this?

 

Once I have a list of VINs, this will allow me to filter down another List of vehicles on the lot by only the vehicles that have ALL the selected options.

 

Thanks!

 

Don

 
Replies
  • Currently Being Moderated
    Jan 2, 2013 9:15 PM   in reply to Don Kerr

    I think you can just brute force check it if there is < 1000 cars.  Use indexOf to test each option against the option string.

     

    If you had 1000’s of cars to test, I would probably convert each option to a bit in a bitmask.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 3, 2013 7:26 AM   in reply to Don Kerr

    If I understand your data, you would loop through the array remembering the last VIN you saw.  If you get through all the options for the VIN without a miss then it does have all of the options.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points