Jump to content

Create Array


Recommended Posts

My Itallian is just fine :). What he wants is something like this:

#include <Array.au3>

Global $minni04 = "si"
Global $minni01 = "come"
Global $minni112 = "ciao"
Global $minni12 = "fai!"
Global $minni13 = "presto"
Global $minni03 = "non"
Global $minni05 = "parla"
Global $minni10 = "fai"
Global $minni02 = "mai"
Global $minni04 = "si"
Global $minni010 = "l'inglese"
;~ ...

Local $pippo[2][41]

For $i = 0 To 1
    For $j = 0 To 40
        $pippo[$i][$j] = Eval("minni" & $i & $j)
    Next
Next

_ArrayDisplay($pippo)

Why does he want that is beyond me and Italian who doesn't know English just isn't right :P

 

trancexx,

You may be right but I question the actual need just as you do. I bet that if/when we get a clue at what this construction is aimed to then we'll provide a completely different and cleaner way.

You knew how much it would be easier for me to explain the problem in my natural language, instead of needing to google for translations, rickshaw that our readers understand anything but compared to what I mean.

So the choice to ask for help just stating the main problem, no detail is a forced choice.

Alberto

Sapeste quanto sarebbe per me più semplice spiegare il problema nella mia lingua naturale, invece avendo bisogno di google per le traduzioni , riscio che ci legge capisca tuttaltro rispetto a quello che voglio dire.

Quindi la scelta di chiedere aiuto solo esponendo il problema principale , senza dettagli è una scelta costretta.

Alberto

Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Link to comment
Share on other sites

trancexx,

You may be right but I question the actual need just as you do. I bet that if/when we get a clue at what this construction is aimed to then we'll provide a completely different and cleaner way.

 

trescon,

Can you describe at a higher level what you are doing and what kind of data the array holds?

kylomas

Yes, now I can not but tomorrow I think I'll do it so you can understand the project to give me maybe easier solutions and more effective.

thanks

Alberto

Si, adesso non posso ma domani penso che lo farò cosi potrete capire il progetto per darmi magari delle soluzioni più semplici e più efficaci.

GRazie

Alberto

Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Link to comment
Share on other sites

Yes, now I can not but tomorrow I think I'll do it so you can understand the project to give me maybe easier solutions and more effective.

thanks

Alberto

Si, adesso non posso ma domani penso che lo farò cosi potrete capire il progetto per darmi magari delle soluzioni più semplici e più efficaci.

GRazie

Alberto

So, here the purpose of the project.

Where I work we sell the material that is subject to warranty, executed by external laboratories that are within the territory in 6 different provinces.

The sectors in which we work are 7.

The laboratories shelter for about 70 Marche.

Each of these 70 brands can give the mandate to more than a laboratory, to the maximum I saw 3.

Here's why a 4D array, to always have a relationship between the 4 types of data.

In the gui then I will have combos, from which the province will select first, then one of the operating segments, and then I can choose the brand that interests me and in the end will select the reference laboratory.

The aim is to always have at hand the procedure to follow to provide product support broken, in the province where the item is located, and that laboratory assign.

Some products are then run through a call center (where I meant that one of the 6 provinces was actually the Call Center.

If you have any other suggestion of how to handle this amount of information, while maintaining the link between them, I accept any suggestions.

thanks

Alberto

Allora , eccovi lo scopo del progetto.

Dove lavoro io vendiamo del materiale che è soggetto a Garanzia , eseguita da laboratori esterni che sono situati sul territorio in 6 province diverse.

I settori nei quali lavoriamo sono 7.

I laboratori riparano per circa 70 Marche.

Ognuna di queste 70 marche può dare il mandato a più di un laboratorio, al massimo io ho visto a 3.

Ecco il perchè dell'array a 4D , per poter avere sempre una relazione tra le 4 tipologia di dati.

Nella gui poi io avrò delle Combo dalle quali selezionerò prima la provincia, poi uno dei settori operativi; poi potro scegliere il marchio che mi interessa e in fine selezionerò il laboratorio di riferimento.

Lo scopo è avere sempre sotto mano la procedura da seguire per offrire l'assistenza al prodotto rotto , nella provincia in cui si trova il prodotto e a che laboratorio assegnarla.

Alcuni prodotti poi vanno gestiti attraverso un call center (dove io intendevo che una della 6 province fosse in realtà il Call Center.

Se avete suggerimento diversi di come gestire questa mole di informazioni, mantenendo il collegamento tra di esse, accetto qualsiasi suggerimento.

Grazie

Alberto

Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Link to comment
Share on other sites

This is still difficult to understand, but thank you for adding this information. I think it's fine to use a 4D array for this. You need to get used to some methods used to add and remove data from multidimensional arrays. I don't know what data you need to include or how it is currently stored (on paper perhaps?), so I can't tell you the best way to populate the array. Anyway I have tried to illustrate some methods and ideas that might help you.

/

Local $iProvincia = 6, $iSettori = 7, $iMarchio = 70, $iLaboratorio = 3

Local $aPippo [$iProvincia] [$iSettori] [$iMarchio] [$iLaboratorio] ; Declare the array

; In your script, get the zero based Index numbers from each Combo control
$iProvincia = 3 ; Selected index number from Combo 1
$iSettori = 2   ; Index number from Combo 2
$iMarchio = 55  ; Index number from Combo 3
$iLaboratorio = 2 ; Index number from Combo 4

$aPippo [$iProvincia] [$iSettori] [$iMarchio] [$iLaboratorio] = "Attenzione" ; Add information to the array

; Add more information
$aPippo [1] [4] [5]  [0] = "Attenzione"
$aPippo [0] [2] [67] [1] = "Attenzione"
$aPippo [4] [6] [69] [1] = "Attenzione"

; Search for the word 'Attenzione'
For $a = 0 To 5 ; Provincia
    For $b = 0 To 6 ; Settori
        For $c = 0 To 69 ; Marchio
            For $d = 0 To 2 ; Laboratorio
                If $aPippo [$a] [$b] [$c] [$d] = "Attenzione" Then ; 'Attenzione' was found
                    ConsoleWrite("Attenzione >>>" & _
                    "  Provincia = " & $a & _
                    ", Settori = " & $b & _
                    ", Marchio = " & $c & _
                    ", Laboratorio = " & $d & _
                    "  <<<" & @CRLF & @CRLF)
                EndIf
            Next
        Next
    Next
Next

;

Run this example in SciTE to see the output.

Edited by czardas
Link to comment
Share on other sites

That's not the way you should store such data. First I guess it has to be persistent across runs and 4D arrays are not first-class candidates for such a container. You should use a small database for storing that and SQLite is exactly what you need to use for that purpose. Also any change in the data should not require changing data in the program.

I'll comment more later about that.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

It's certainly not the standard way to store data. I always use csv format for my own data storage purposes (that is already a 3D array). All that is required is that the data can be written to file, accessed in some way and queried - although I am not suggesting that using an array is in any way better than using SQLite.

Edited by czardas
Link to comment
Share on other sites

The issue with an array (especially > 2D) is that there is not good standard format for it and if a change in any dimension is needed, then the application + extra programs to maintain data are to be adapted. Also a lab is likely to handle many brands, hence dupplication of data in a non-sparse array. If that lab changes name (being spinned off or merged) the change becomes a nightmare if the storage format is not suitable. A DB is the most flexible/reliable way to handle the data.

Also it's very unlikely that every cell in the OP 4D array would be holding unique data!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Oh I'm certainly not above criticism and I don't have a priviledged access to good ideas!

@trescon,

Could you clarify the terms: province, sector and operating segment. You (or google translate) seem to mix up some of them. I'd like to have a precise meaning for supplying a basic DB squeleton for you to evaluate.

In post #18 you said $foo[5] [6] [70] [3]

I can see what the 70 and 3 stand for but above you say you have 6 provinces and 7 sectors, so this imaginative array would have to be $foo[6] [7] [70] [3]. Is my interpretation correct?

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Oh I'm certainly not above criticism and I don't have a priviledged access to good ideas!

 

@trescon,

 

Could you clarify the terms: province, sector and operating segment. You (or google translate) seem to mix up some of them. I'd like to have a precise meaning for supplying a basic DB squeleton for you to evaluate.

 

In post #18 you said $foo[5] [6] [70] [3]

 

I can see what the 70 and 3 stand for but above you say yoùu have 6 provinces and 7 sectors, so this imaginative array would have to be $foo[6] [7] [70] [3]. Is my interpretation correct?

Yes, your interpretation is correct, $foo[6] [7] [70] [3].

I just, I don't know, but it seems to me unlikely that I riesc to use a SQL dbase.

Thank You

Alberto

---------------------------------------------------

I am translate with Google.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...