Jump to content
Sign in to follow this  
Virgilio1

Array use

Recommended Posts

Virgilio1

Hi,

I have a script in a global multi-dimensional array that every interaction has to be reset.

use this code in the while loop:

Global $retDati[1][1]
Global  $DatiStampa [1][6]
Global $ListView1
 
 
 
func StartLoad()
Dim $riga[5]
Dim $Conta = 1
$cartella = @ScriptDir
$search = FileFindFirstFile($cartella & "\*.xml")
_GUICtrlListView_DeleteAllItems($ListView1)
While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
              $riga = LoadDati($cartella, $file)   ; Load Data from XML file
      if $conta > 1 then
                ; append new empty row
                Redim $retDati[Ubound($retDati)+1][1]
                Redim $DatiStampa[Ubound($retDati)+1][6]
      else
                 ;clear the array
                 Redim $retDati [1][1]
                 Redim $DatiStampa [1][6]
     EndIf
     $conta += 1
    LoadArrayGlobale($riga) ; append the Data to global array
WEnd
FileClose($search)
_GUICtrlListView_AddArray($ListView1, $retDati)
GUISetState(@SW_SHOW)
EndFunc
 
Func LoadArrayGlobale($riga)
  $retDati[Ubound($retDati)-1][0] = $riga[$CRagioneSociale]
  $DatiStampa[Ubound($retDati)-1][$CRagioneSociale] = $riga[$CRagioneSociale]
  $DatiStampa[Ubound($retDati)-1][$CIndirizzo] = $riga[$CIndirizzo]
  $DatiStampa[Ubound($retDati)-1][$CCodiceFiscale] = $riga[$CCodiceFiscale]
  $DatiStampa[Ubound($retDati)-1][$CDataIncarico] = $riga[$CDataIncarico]
  $DatiStampa[Ubound($retDati)-1][$CAmminstratore] = $riga[$CAmminstratore]
  $DatiStampa[ubound($retDati)-1][$CCaricaAmministratore] = $riga[$CCaricaAmministratore]
EndFunc

But it does not work as I thought, in fact I ended with an array of multiple lines due to (n * x line interactions)

Edited by Virgilio1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×