Array problem

Results 1 to 2 of 2

Thread: Array problem

  1. #1
    Join Date
    Dec 1969

    Default Array problem

    Hello, <BR>I have two array statements I want to bring into two seperate variables. The reason I have created this array is because the information may variate depending on what the user selects..such as if the user selects information in this particular asp&#039;s previous page he could choose information spanning 1 week to six weeks. Then the array gets that information and populates the variable. Problem is that this variable produces a bar chart and I have extra bars appears with a quanity of ). I have set the array to have at least six values apiece. If I do not put in a value I recieve an error statement on my y variable stating it cannot do that. Can anyone help me to rewrite my statement so that the number of times that the array gets a new variable = number of bars that displays.<BR><BR>Presently, this is what I have: <BR><BR>&#039;This puts all the dates and amount available into an array<BR>Dim date(6) , available(6)<BR><BR>y = 0<BR>do<BR> y = y + 1<BR> date(y) = rs3("date")<BR> available(y) = rs3("AmountAvailable")<BR> rs3.movenext<BR>Loop until rs3.eof<BR>rs3.movefirst<BR><BR><BR>&#039; This is the variable that stores the StyleNumber Value<BR><BR>Dim Style<BR>Style = Request.QueryString("StyleNumber")<BR><BR>&#039; This creates the array that the chart is based on<BR><BR> ShowChart available , date , Style , "Weeks", "Slots Available"

  2. #2
    Join Date
    Dec 1969

    Default RE: Array problem

    I don&#039;t completely understand your question.<BR><BR>One problem I see is that you aren&#039;t putting *any* values into date(0) [and you should *not* use that name! It&#039;s a keyword!] or available(0).<BR><BR>Does your ShowChart code ignore element zero?<BR><BR>Anyway, I *THINK* you are asking for something like this:<BR><BR>&#060;%<BR>Dim adate(), available()<BR>ReDim adate(100), available(100)<BR><BR>y = 0<BR>Do <BR>&nbsp; &nbsp; y = y + 1<BR>&nbsp; &nbsp; If y &#062; UBound( adate ) Then<BR>&nbsp; &nbsp; &nbsp; &nbsp; ReDim Preserve adate( y + 20 )<BR>&nbsp; &nbsp; &nbsp; &nbsp; ReDim Preserve available( y + 20 )<BR>&nbsp; &nbsp; End If<BR>&nbsp; &nbsp; adate(y) = rs3("date")<BR>&nbsp; &nbsp; available(y) = rs3("AmountAvailable")<BR>&nbsp; &nbsp; rs3.MoveNext<BR>Loop Until rs3.EOF<BR>&#039; chop arrays back to the right size<BR>ReDim Preserve adate(y)<BR>ReDim Preserve available(y)<BR><BR>... and then the rest of your code...<BR><BR>%&#062;<BR><BR>See if that helps. But I have to tell you, I really didn&#039;t understand your question. Maybe you need to explain it slowly and in small pieces.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts