Jump to content
VinMe

Array variable has incorrect number of subscripts or subscript dimension range exceeded

Recommended Posts

Posted (edited)

I am unable compare two 1d arrays  and to assign values to third array $aDSloc1, Please help me out

Local $aDSloc1[$LastRow]
For $i = 1 To $LastRow
    For $j = 1 To $LastRow1
        If $aDSlist1[$i]== $aLocDS1[$j] Then
            $aDSloc1[$i] = $aDSloc1[$i]+"," + $aLocNr1[$j]

        EndIf
    Next
Next

Edited by VinMe

Share this post


Link to post
Share on other sites

FOR $J=0 To $lastrow-1

???


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2019-10-01

Share this post


Link to post
Share on other sites

ceratainly yes mLipok!! that was my stupid mistake. updated code looks like this.

Local $aDSloc1[1] = [""]
For $i = 1 To $LastRow
    For $j = 1 To $LastRow1-1
        If $aDSlist1[$i] == $aLocDS1[$j] Then
            $aDSloc1[$i] = $aDSloc1[$i] + "," + $aLocNr1[$j]
        EndIf

    Next
    ReDim $aDSloc1[$LastRow]

    _Excel_RangeWrite($oWorkbook, $oWorkbook.ActiveSheet, $aDSloc1[$i], "H" & ($i))
Next

But one more question here, is the below code line is good? i am not getting the right result so..

$aDSloc1[$i] = $aDSloc1[$i] + "," + $aLocNr1[$j]

Share this post


Link to post
Share on other sites

'&' is the string concatenation character not '+'

 

$aDSloc1[$i] = $aDSloc1[$i] & "," & $aLocNr1[$j]

 

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

  • Similar Content

    • By Jcreator
      i have a file flower.txt with the name of the flowers and there picture location and information about that kind of flower. i wana cerat a gui that will display the flower picture and it information 
      here is the script 
      #include <Misc.au3> #include <EditConstants.au3> #include <Constants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <GuiComboBox.au3> #include <GuiTab.au3> #include <file.au3> #include <array.au3> Global $sfPath = 'flowers.txt' Global $aFlowers _FileReadToArray($sfPath,$aFlowers,$FRTA_NOCOUNT,'|') _ArrayColDelete($aFlowers,0) ;row 0 has no data so deleting $Form1 = GUICreate("Search Flower Name",320, 480) $input = GUICtrlCreateInput("", 60, 360, 209, 25) $idss = GUICtrlCreateButton("Search", 130, 400, 73, 65) GUISetState(@SW_SHOW) Func Searchf() Global $Fname = GUICtrlRead($input) For $iNo = 0 To UBound($aFlowers[0][0]) - 1 ; if $Fname = $aFlowers[$iNo][0] then MsgBox($MB_SYSTEMMODAL, "","Flower nfo", ""& $aFlowers[$iNo][1] &"") pic() EndIf Next EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $nMsg = $idss Searchf() EndSwitch WEnd func pic() For $iNo = 0 To UBound($aFlowers[0][0]) - 1 GUICtrlCreatePic($aFlowers[$iNo][2], 20, 30, 280, 280) Next EndFunc here is the flower.txt file
      |Hibiscus|Hibiscus is a hardy perennial which grows in variety of colors, sizes and fragrances. Actually they are tropical flowers which require ample sunlight and moisture to grow well. These flowers start blooming in late spring and continuously bloom through July and August.|C:\T-in\IMG\2.jpg |Lilies|There are different types of lily flowers which bloom in August including water lilies, tiger lilies and gold band lilies. Tiger lilies generate orange flowers having black spots. This lily blooms in delayed July and beginning of August. Gold band lily produce exotic white blooms. All varieties of lilies need enough space to grow and protection from summer sun.|C:\T-in\IMG\1.jpg |Turtlehead|Growing in humid areas, turtleheads are small flowers which bloom from July to September. They mostly produce flowers of white and pink color.|C:\T-in\IMG\3.jpg |Hydrangea|These are ever green bushes which produce flowers in different colors including white, purple, blue and pink. They are easy to grow bushes and can grow 3 to 10 feet tall. They require morning sun to grow but they should be protected from noon and afternoon sun.|C:\T-in\IMG\4.jpg |Dahlias|August proves to be the peak blooming season for dahlias. Dahlias come in colors like white, orange, yellow, red and purple. They can tolerate all types of soil and require full sun to grow.|C:\T-in\IMG\5.jpg am still trying to learn about how the ubound work and the _filereadtoarray
    • By Peggy
      [Rule]
      1. A start would be to get this excel spreadsheet, people called the group, a total divided into two groups: Mary, Sam, Jack

      2. Every person eating a fruit, and each times one person can eat the same fruit (or random fruit)
      3. Last eaten fruit can not eat
      4. so be scheduled
      5. If the previous round fruits are finished, the remaining number can pick one randomly 
      6. If I have more than 100 the number of Name(people), how can I to code it?

      Picture:
      1. The first time Mary eat Apple, Sam  can  eat Apple(or random),and Jack chose random first to eat.

      2. The second They are chose random first to eat.

      3. Third  They are chose random first to eat.

      4. Fourth Sam chose tomato,because the previous round fruits are finished, the remaining number can pick one randomly ,Jack is too.

      5. Fifth Sam chose tomato,because the previous round fruits are finished, the remaining number can pick one randomly ,Jack is too.
       


      Currently only think of using arrary and for next loop to write it, but I do not know to write Detailing, want to please help me, thank you very much !!!! Thank you!!
       
       
       
       
       
       
×
×
  • Create New...