Hi,
I am trying to execute a query that and then load it into an array so I can re-format/tabulate the results.
I want the array to have 8 columns although I'm not sure how many rows there will be
0 - FEE-EARNER;
1 - FEETR_0.CHARGE-RATE;
2 - NAME
3 - FEBANDS_0.CHARGE-RATE If BAND = 'COM1'
4 - FEBANDS_0.CHARGE-RATE If BAND = 'COMM'
5 - FEBANDS_0.CHARGE-RATE If BAND = 'CHAR1'
6 - FEBANDS_0.CHARGE-RATE If BAND = 'CHAR'
7 - FEBANDS_0.CHARGE-RATE If BAND = 'CONY'
Ultimately I want to loop through the recordset and in pseudo-code do the following
1. Populate columns 0-2 in the array
2. Look at the 'band' and the 'febands_0.charge-rate' values and populate columns 3-7 accordingly for that row in the array
3. Move onto the next row in the recordset and repeat step 2 as long as the fee-earner value is the same as the last row in the recordset.
4. Start a new row in the array and go back to step 1.
Any help much appreaciated - I am really struggling with arrays!
cheers
Ed
<%
Set DB = Server.CreateObject("ADODB.Connection")
Set TBL = Server.CreateObject("ADODB.RecordSet")
DB.Mode = adModeReadWrite
DB.Open "SOS", "myusername", "mypassword"
Response.Write("Connection established!")
TBL.Open "SELECT FEETR_0.""FEE-EARNER"", FEETR_0.""CHARGE-RATE"", FEETR_0.NAME, FEBANDS_0.BAND, FEBANDS_0.""CHARGE-RATE"" FROM PUB.FEBANDS FEBANDS_0, PUB.FEETR FEETR_0 WHERE FEBANDS_0.""FEE-EARNER"" = FEETR_0.""FEE-EARNER"" AND ((FEBANDS_0.BAND='comm') OR (FEBANDS_0.BAND='com1') OR (FEBANDS_0.BAND='char') OR (FEBANDS_0.BAND='cha1') OR (FEBANDS_0.BAND='cony')) ORDER BY FEETR_0.""FEE-EARNER""", DB
Dim ChargeRates()
counter=0
Do While Not TBL.EOF
TBL.MoveNext
counter=counter+1
Loop
TBL.Close
Set TBL=Nothing
Set DB=Nothing
%>
I am trying to execute a query that and then load it into an array so I can re-format/tabulate the results.
I want the array to have 8 columns although I'm not sure how many rows there will be
0 - FEE-EARNER;
1 - FEETR_0.CHARGE-RATE;
2 - NAME
3 - FEBANDS_0.CHARGE-RATE If BAND = 'COM1'
4 - FEBANDS_0.CHARGE-RATE If BAND = 'COMM'
5 - FEBANDS_0.CHARGE-RATE If BAND = 'CHAR1'
6 - FEBANDS_0.CHARGE-RATE If BAND = 'CHAR'
7 - FEBANDS_0.CHARGE-RATE If BAND = 'CONY'
Ultimately I want to loop through the recordset and in pseudo-code do the following
1. Populate columns 0-2 in the array
2. Look at the 'band' and the 'febands_0.charge-rate' values and populate columns 3-7 accordingly for that row in the array
3. Move onto the next row in the recordset and repeat step 2 as long as the fee-earner value is the same as the last row in the recordset.
4. Start a new row in the array and go back to step 1.
Any help much appreaciated - I am really struggling with arrays!
cheers
Ed
<%
Set DB = Server.CreateObject("ADODB.Connection")
Set TBL = Server.CreateObject("ADODB.RecordSet")
DB.Mode = adModeReadWrite
DB.Open "SOS", "myusername", "mypassword"
Response.Write("Connection established!")
TBL.Open "SELECT FEETR_0.""FEE-EARNER"", FEETR_0.""CHARGE-RATE"", FEETR_0.NAME, FEBANDS_0.BAND, FEBANDS_0.""CHARGE-RATE"" FROM PUB.FEBANDS FEBANDS_0, PUB.FEETR FEETR_0 WHERE FEBANDS_0.""FEE-EARNER"" = FEETR_0.""FEE-EARNER"" AND ((FEBANDS_0.BAND='comm') OR (FEBANDS_0.BAND='com1') OR (FEBANDS_0.BAND='char') OR (FEBANDS_0.BAND='cha1') OR (FEBANDS_0.BAND='cony')) ORDER BY FEETR_0.""FEE-EARNER""", DB
Dim ChargeRates()
counter=0
Do While Not TBL.EOF
TBL.MoveNext
counter=counter+1
Loop
TBL.Close
Set TBL=Nothing
Set DB=Nothing
%>