D
drdave
Hi All,
I'm filling an arraylist with other arraylists within a loop and within
the first iteration and addition all is fine.. however when I clear my
value holding temporary array I lose the values already in the output
array..
the code..
'******** LOOP OVER THE PROVINCE ID VALUES ********************
For Each y in ProvArrList
'there are 14 provinces
' '**** OUTPUT THE QUERY *****************************
'there are 10 years
For Each x in YearArrList
n = (x + 1)
n = "12/31/" & n
x = "12/31/" & x
Dim s As String = ""
' Get the years and jurisdictions
Dim filterstatement As New StringBuilder
filterstatement.append ("effective_date >
#").Append(x).Append("#").Append("And effective_date <
#").Append(n).Append("#").Append("AND prov_prov_id = ").Append(y.Key)
Dim Filter As String = (filterstatement.ToString())
Response.Write (Filter)
DBDataView.RowFilter = Filter
'Add the values into my temporary holding arraylist
If DbDataView.Count < 1
arrTemplist.Add (" ")
Else
For Each drv In DBDataView
s &= Format(drv("effective_date"),"D")& ControlChars.NewLine &
formatCurrency(drv("minimum_wage_amount")) &
drv("mwv_minimum_wage_variation_id") & "p= " & drv("prov_prov_id")
arrTemplist.Add (s)
Next
End If
' End of Years
Next
arrHolder.Add (arrTemplist)
arrTemplist.Clear () <!----------------------------------- CLEARS
arrHolder existing values also
Next
Hopefully this is clear enough but here is the debug output..
in the first iteration I get my values and all is good:
+ arrTemplist {Length=10}
- arrHolder {Length=1}
+ (0) {Length=10}
After I run arrtemplist.Clear it clears my arrHolder arrtemplist
arrTemplist {Length=0}
- arrHolder {Length=1}
(0) {Length=0}
Why does this happen?? How can I empty my temp list and keep my good
values..
thx.
I'm filling an arraylist with other arraylists within a loop and within
the first iteration and addition all is fine.. however when I clear my
value holding temporary array I lose the values already in the output
array..
the code..
'******** LOOP OVER THE PROVINCE ID VALUES ********************
For Each y in ProvArrList
'there are 14 provinces
' '**** OUTPUT THE QUERY *****************************
'there are 10 years
For Each x in YearArrList
n = (x + 1)
n = "12/31/" & n
x = "12/31/" & x
Dim s As String = ""
' Get the years and jurisdictions
Dim filterstatement As New StringBuilder
filterstatement.append ("effective_date >
#").Append(x).Append("#").Append("And effective_date <
#").Append(n).Append("#").Append("AND prov_prov_id = ").Append(y.Key)
Dim Filter As String = (filterstatement.ToString())
Response.Write (Filter)
DBDataView.RowFilter = Filter
'Add the values into my temporary holding arraylist
If DbDataView.Count < 1
arrTemplist.Add (" ")
Else
For Each drv In DBDataView
s &= Format(drv("effective_date"),"D")& ControlChars.NewLine &
formatCurrency(drv("minimum_wage_amount")) &
drv("mwv_minimum_wage_variation_id") & "p= " & drv("prov_prov_id")
arrTemplist.Add (s)
Next
End If
' End of Years
Next
arrHolder.Add (arrTemplist)
arrTemplist.Clear () <!----------------------------------- CLEARS
arrHolder existing values also
Next
Hopefully this is clear enough but here is the debug output..
in the first iteration I get my values and all is good:
+ arrTemplist {Length=10}
- arrHolder {Length=1}
+ (0) {Length=10}
After I run arrtemplist.Clear it clears my arrHolder arrtemplist
arrTemplist {Length=0}
- arrHolder {Length=1}
(0) {Length=0}
Why does this happen?? How can I empty my temp list and keep my good
values..
thx.