Hello,
I am asking for the help with a select query. I have a table of "factors" by "state code" and by some "program code".
There are 12 factors (12 fields of factors: "Factor One",..., "Factor Twelve") plus 2 fields for state and program.
Some factor fields can be blank. The decimal values of factors are gradualy increasing with 0.05 increment starting with 0.6 for "Factor One" and ending with 1.15 for "Factor Twelve".
This is example of a record:
State Code AZ
Program Code O
Factor One 0.6
Factor Two
Factor Three
Factor Four 0.75
Factor Five
Factor Six 0.85
Factor Seven
Factor Eight
Factor Nine 1.0
Factor Ten
Factor Eleven
Factor Twelve 1.15
There are two (2) non-blank input parameters for the query (in addition to the "State Code" and the "Program Code").
The first input value is the "proposed tier move" for the query, which is the integer beween -11 and 11.
The second input value is the "initial factor", which is the decimal between 0.6 and 1.15.
The query should produce the "actual factor" and the "actual tier move" for the given "State Code" and the "Program Code"
For the above example record:
If the "proposed tier move" is -3 and the "initial factor" is 1.0 then it must produce 0.85 and -3.
If the "proposed tier move" is 3 and the "initial factor" is 1.0 then it must produce 1.15 and 3.
If the "proposed tier move" is too big (jumps beyond the limits of available factors, or fields)then the furthest non-blank factor with the correcponding actual tier move must be given as an output.
However, the pattern of the blank fields is unique for each record.
If input values hit the blank field then the query should produce the furthest before this blank field in the appropriate direction non-blank factor value and the corresponding "actual tier move".
For example, the "proposed tier move" of -7 and the "initial factor" of 1.0 will give 0.75 and -5,
and the "proposed tier move" of 2 and the "initial factor" of 1.0 will give 1.0 and 0.
I am struggling with formalization of the logic for the proposed query.
I will appretiate any help.
Thank you
vladk
I am asking for the help with a select query. I have a table of "factors" by "state code" and by some "program code".
There are 12 factors (12 fields of factors: "Factor One",..., "Factor Twelve") plus 2 fields for state and program.
Some factor fields can be blank. The decimal values of factors are gradualy increasing with 0.05 increment starting with 0.6 for "Factor One" and ending with 1.15 for "Factor Twelve".
This is example of a record:
State Code AZ
Program Code O
Factor One 0.6
Factor Two
Factor Three
Factor Four 0.75
Factor Five
Factor Six 0.85
Factor Seven
Factor Eight
Factor Nine 1.0
Factor Ten
Factor Eleven
Factor Twelve 1.15
There are two (2) non-blank input parameters for the query (in addition to the "State Code" and the "Program Code").
The first input value is the "proposed tier move" for the query, which is the integer beween -11 and 11.
The second input value is the "initial factor", which is the decimal between 0.6 and 1.15.
The query should produce the "actual factor" and the "actual tier move" for the given "State Code" and the "Program Code"
For the above example record:
If the "proposed tier move" is -3 and the "initial factor" is 1.0 then it must produce 0.85 and -3.
If the "proposed tier move" is 3 and the "initial factor" is 1.0 then it must produce 1.15 and 3.
If the "proposed tier move" is too big (jumps beyond the limits of available factors, or fields)then the furthest non-blank factor with the correcponding actual tier move must be given as an output.
However, the pattern of the blank fields is unique for each record.
If input values hit the blank field then the query should produce the furthest before this blank field in the appropriate direction non-blank factor value and the corresponding "actual tier move".
For example, the "proposed tier move" of -7 and the "initial factor" of 1.0 will give 0.75 and -5,
and the "proposed tier move" of 2 and the "initial factor" of 1.0 will give 1.0 and 0.
I am struggling with formalization of the logic for the proposed query.
I will appretiate any help.
Thank you
vladk