Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8867391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:01:06+00:00 2026-06-14T17:01:06+00:00

i have an array path… this array contains a list of nested array paths.

  • 0

i have an array path… this array contains a list of nested array paths. it could look something like this:

path( 0  1  2  3  4  5  6  7  8 )
"1" | 1, 1, 1, 1, 1, 1, 1, 1, 1 |
"2" | 4, 3, 1, 4, 2, 3, 4, 3, 2 |
"3" | 1, 1,  , 2, 1, 2, 3, 3, 2 |
"Val" A, B, C, D, E, F, G, H, I

now i have a small loop to get the maximum of the second row.

x = 1
For c = 0 To UBound(path)
   If IsArray(path(c)) Then
        If CInt(path(c)(x)) <= maxDimension1 Then
        maxDimension1 = CInt(path(c)(x))
        End If
    End If
Next
redim preserve pathValues(maxDimension1 - 1)

i must now find the maximum number of elements for the elements in row “2” and redim the array-Element in pathValues to this.
i tried:

For Dimension2 = 1 To maxDimension1
    For c = 0 To UBound(Path)
        If IsArray(Path(c)) Then
            If CInt(Path(c)(x)) = Dimension2 Then
                If CInt(Path(c)(2)) >= maxDimension2 Then
                maxDimension2 = CInt(Path(c)(2))
                End If
            End If
        End If
    redim PathValues(c)(maxDimension2) //Syntax Error
    next
next

is there a way to avoid a workaround with multidimensional array?
for explanation: the pathValues would look like this in the end:

PathValues() = (C,(E, I),(B, F, H),(A, D, G))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:01:07+00:00Added an answer on June 14, 2026 at 5:01 pm

    I fixed it by recursively calling a function that uses x as “depth” and the full path to create one single array containing empty elements for the values that get written in later.
    one just needs to add a statement sorting out the upper bounds you do not want because they belong to other arrays. for all else it works fine

    Function iterate_Path(path As Variant, x As Integer, value_x As Variant) As Variant
    Dim insideArray, returnPath
    returnPath = Array()
    
    For c = 0 To UBound(path)
        If IsArray(path(c)) Then
           If CInt(path(c)(x)) = value_x Then
                If x <> UBound(path(c)) Then
                    If CInt(path(c)(x)) > UBound(returnPath) + 1 Then
                        ReDim Preserve returnPath(CInt(path(c)(x)) - 1)
                    End If
                    returnPath(path(c)(x) - 1) = iterate_Path(path, x + 1, path(c)(x))
                ElseIf CInt(path(c)(x)) > UBound(returnPath) + 1 Then
                    ReDim Preserve returnPath(CInt(path(c)(x)) - 1)
                End If
           ElseIf CInt(path(c)(x)) > UBound(returnPath) + 1 Then
                ReDim Preserve returnPath(CInt(path(c)(x)) - 1)
                If x + 1 = UBound(path(c)) Then
                returnPath(CInt(path(c)(x)) - 1) = iterate_Path(path, x + 1, path(c)(x))
                End If
           ElseIf x + 1 = UBound(path(c)) Then
                If CInt(path(c)(x)) > UBound(returnPath) + 1 Then
                    ReDim Preserve returnPath(CInt(path(c)(x)) - 1)
                End If
                returnPath(CInt(path(c)(x)) - 1) = iterate_Path(path, x + 1, path(c)(x))
           End If
        Else
            returnPath(CInt(path(c)(x)) - 1) = Empty
        End If
    Next
    iterate_Path = returnPath
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array filled with paths looking like this: library/main/single/list.php library/article/grid/thumbs.php library/footer/tiny.php These
I have an array of file path components like this: [ ['some', 'dir', 'file.txt'],
I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
I have an array of file-path strings like this videos/funny/jelloman.wmv videos/funny/bellydance.flv videos/abc.mp4 videos/june.mp4 videos/cleaver.mp4
I have an array of image files with relative paths, like this: gallery/painting/some_image_name.jpg .
I have array result like this: Array ( [0] => stdClass Object ( [id_global_info]
I have an array $templates that looks like this: Array ( [0] => Array
i have a multidimensional array: $image_path = array('sm'=>$sm,'lg'=>$lg,'secondary'=>$sec_image); witch looks like this: [_media_path:protected] =>
I have a path like: /blog/2/post/45/comment/24 Can I have an array depends on what
If i have an array of coordinates for a path(Such as in a paint

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.