Re: Using a matrix to produce a result

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Phill. W (P.A.Ward_at_o-p-e-n-.-a-c-.-u-k)
Date: 02/25/05


Date: Fri, 25 Feb 2005 13:34:27 -0000


"Scott" <hotcakes7@virgin.net> wrote in message
news:ukFTd.272$hj1.145@newsfe3-gui.ntli.net...
> I have generated a form that inserts travel information and I need to
> manipulate that info. All the info is now stored in variable and i need
to
> generate prices... Its a little complicated cos there is not a relative
> price structure. Ill try and explain whets happening...
>
> variable1 - either european or worldwide
> variable2 - 1_person, 2_people or a family
> variable3 - standard_baggage or include_luggage
> variable4 - length of trip (either 1-5, 6-10, 11-17, 18-24, 25-31 & 32-38
> days)
>
> the first 3 variables are radio buttons and the last one is a text box and
I
> have all the info in variables.

A suggestion -

European or Worldwide - 2 possible cases
Standard or Include luggage - 2 possible cases
1, 2, or family - 3 possible cases

That gives you twelve (2 * 2 * 3) possibilities of these three values.
With a little arithmetical jiggery-pokery, you could merge these into
a single value, as in

0 = European, 8 = WorldWide

0 = Standard (Luggage), 4 = Include

0 = 1 person
1 = 2 persons
2 = family

Now, you simply add up the selected values to get a single result
for any combinatio of the three fields, as in

0 = European, Standard, 1_Person
1 = European, Standard, 2_Person
2 = European, Standard, Family
4 = European, Include, 1_Person
5 = European, Include, 2_Person
6 = European, Include, Family
8 = WorldWide, Standard, 1_Person
9 = WorldWide, Standard, 2_Person
10 = WorldWide, Standard, Family
12 = WorldWide, Include, 1_Person
13 = WorldWide, Include, 2_Person
14 = WorldWide, Include, Family

Now, if you create "bands" for your durations as well,

0 = 1-5
1 = 6-10
2 = 11-17
3 = 18-24
etc.

You can create a simple matrix linking the two (OK, it'll have a few
holes in it.)

Alternatively, you /might/ want to consider dropping all of this data
into a Database of some sort - this is /just/ what they're good at!

HTH,
    Phill W.


Quantcast