https://bz.apache.org/bugzilla/show_bug.cgi?id=65514

            Bug ID: 65514
           Summary: Resize Preserve Empty My Array
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

I often call for a table resizing with the little magic keyword Preserve ....
Since version 4.1.7 I have noticed a problem with Preserve which seems to stop
responding. I got around the issue in the following code but I would like to
point it out to the developers because it is rather annoying. 

Attached is a small snippet of my code to prove my point. The names of my
variables may seem curious but they respond to the fact that my code uses
several modules and sometimes different libraries where very many variables,
sometimes very close, are used and the prefixes of the variables are very
useful for me to find my way around.
Thus GLS (indicates that it is a variable of type GLobal String)
DI (indicates that it is a variable defined locally in a Sub or a function of
type S for String, I for Integer, D for Double etc ... 

       Dim DIBFlag As Boolean

       Dim DIIAn As Integer
       Dim DIIN As Integer
       Dim DIIZRegimes() As Integer
       Dim DIIZRegimesExp() As Integer
       Dim DIIZRegimesInt() As Integer

       Dim DISFlux As String
       Dim DIST As String
       Dim DISZFlux() As String

       DISZFlux=Array("Introduction","Expédition") ' Flows for each year 
       DIIZRegimesExp=Array(21,25,26,29,31)
       DIIZRegimesInt=Array(11,19)

       For DIIAn=2016 To 2021
          For Each DISFlux In DISZFlux()
             Select Case DISFlux
                Case "Expédition"
                   DIIZRegimes()=DIIZRegimesExp()
                   If DIIAn>2019 Then
                      DIIN=Ubound(DIIZRegimes)+1
                      ReDim Preserve DIIZRegimes(DIIN) ' resizing is done but
without taking into account Preserve 
                      DIIZRegimes(DIIN)=20 ' and in addition no way to fill in
the last element added 
                      'DIIZRegimes()=Split(Join(DIIZRegimes,";") & ";20",";") '
bug workaround 
                   End If'If DIIAn>2019 Then
                Case "Introduction"
                   DIIZRegimes()=DIIZRegimesInt()
             End Select
             Msgbox "DIIAn=(" & DIIAn & ") DISFlux=[" & DISFlux & "]
Ubound(DIIZRegimes)=(" & Ubound(DIIZRegimes) & ") :" & _
                         Chr(13) & "{" & Join(DIIZRegimes,";") & "}"
          Next 'For Each DISFlux In DISZFlux()
       Next DIIAn 'For DIIAn=2016 To 2021

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to