mardi 29 septembre 2020

What is the best way to map assignment values with a variable amount of conditions

I am having trouble coming up with the terms to even search for solutions to a problem

I would like to move away from nested if/else statements and an iffy DB design to solve for a problem of selecting values for assignment. Values have any number of conditions for assignment:

user -

location code:12, country:us, state:fl, client code:12, Program Code:120, Job Family: agent

mapping -

Location Code,  Country,    State,  Client Code,    Program Code,   Job Family
*               US          *       *               *               agent
*               US          *       12              *               *
12              US          FL      12              120             *
12              US          FL      12              *               agent

For our current implementation our solution is to match based off of the highest total number of matches. In the above example, the user matches all 4. The latter 2 each have 5 matches, so the result is whichever entry in the database was created first. I have been searching for a while and figured I'd come here and see if anyone can help point me in the direction of a pattern to solve this.

Aucun commentaire:

Enregistrer un commentaire