Weighted scores ?

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Hi,
Can someone sugest the best way to map one number to another. i.e. 110
becomes 99, 109 becomes 97 or somthing like 105 to 100 becomes 67. I have 20
values that I need to map in this manner and I would like to be able to
change the mappings easily at a later date. The only way I can think of is
to use a case select. Is there a better way?
Thanks,
Jim
 
How about using an array of integers that you use for an array lookup? Air
code:

Dim WeightedScores(...) as Integer
....
WeightedScores(100) = 67
WeightedScores(101) = 67
WeightedScores(102) = 67
....
WeightedScores(109) = 97
WeightedScores(110) = 99
....

You could then access the weighted scores through a line like:

TrueScore = WeightedScores(x)

(with x being the unweighted score.)

The bonus is that this code should run faster than a long Select Case. (If
you wanted to get fancy, you could store the array values in an XML file,
but that's overkill for just 20 values.)

Hope this helps,
Robert Jacobson
 
In Jim <[email protected]> typed:
: Hi,
: Can someone sugest the best way to map one number to another. i.e. 110
: becomes 99, 109 becomes 97 or somthing like 105 to 100 becomes 67. I
: have 20 values that I need to map in this manner and I would like to
: be able to change the mappings easily at a later date. The only way I
: can think of is to use a case select. Is there a better way?

Use a database.

tbl WeighedScores
ActualScore (PK)
WeightedScore

Then you don't need to change the application code everytime you want to
change the weighting. You could also add a weighted type if you wanted to
have several different methods of weighting.

Don Verhagen







: Thanks,
: Jim
 
Back
Top