Results 1 to 2 of 2

Thread: Lookup table

  1. #1
    Join Date
    Sep 2005

    Unanswered: Lookup table

    I have a situation where I need to use the following logic. If an item is non-stocking at LOC1, the system checks LOC4 first to see if it is stocking at that location, LOC2 second, LOC3 third, etc. If no stocking LOC is found, the records remain unmodified.

    		     Stocking LOC (in order of precedence) 
          Non-Stocking LOC            1         2           3         4         5
                  LOC1                LOC4    LOC2     LOC3     LOC5
                  LOC2                LOC4    LOC1     LOC2     LOC5
                  LOC3                LOC5     LOC4    LOC1     LOC2
                  LOC4                LOC1    LOC3     LOC2     LOC5
                  LOC5	           LOC3    LOC4     LOC1     LOC2
                  LOC6                LOC4     LOC2    LOC1      LOC5     LOC3
    Right now we have a whole series of IF statements to work through this logic. When we add a location, a lot of code needs to be changed. Is there a way to build this into a table and be able to do the lookup more effectively, and that would make it easier to add a location?

    Thanks in advance.

  2. #2
    Join Date
    Nov 2002
    I'd propose a more normalized table with 3 fields:
    Non_stocking_loc, stocking_loc, precedence

    Given a non-stocking loc, it's easy to retrieve all stocking locs for it, ordered by precedence.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts