Results 1 to 12 of 12

Thread: 2 Dimesnion array with Dynamic Values

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2016
    Posts
    46

    2 Dimesnion array with Dynamic Values

    Hi

    How to create 2 Dimension array dynamically and preserve values. In a database i have Sales Figure , Brand , Year.


    Hyundai 2010 10
    Hyundai 2011 5
    Hyundai 2010 4

    Tata 2008 10
    Tata 2011 20
    Tata 2012 5

    I want to display data like below

    2008 2010 2011 2012
    Hyundai 0 14 5 -
    Tata 10 - 20 5

    Thanks

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: 2 Dimesnion array with Dynamic Values

    Little vague here...are you saying you want something like this?

    Make 2008 2009 2010 2011 2012
    Hyundai 0 0 14 5 0
    Tata 10 0 0 20 5

    A flexgrid is a good control to use to display tabular data.
    Last edited by SamOscarBrown; Oct 25th, 2021 at 07:47 AM.
    Sam I am (as well as Confused at times).

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2016
    Posts
    46

    Re: 2 Dimesnion array with Dynamic Values

    Hi Sam

    Yes . FlexGrid is o.k . Can u help with array how it can be done . There can be more records in a data . If there is different year then accordingly that column year should be created

    Thanks

  4. #4
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: 2 Dimesnion array with Dynamic Values

    If there is tabular Data in a Database, why in blazes do you want to "preserve" values in an Array?
    Sam's Result above is easy to retrieve via SQL, and easy to display in a Grid.

    This begs the question: Whatever is the array for?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  5. #5
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: 2 Dimesnion array with Dynamic Values

    Yeah, like this:

    Name:  Capture.JPG
Views: 170
Size:  19.4 KB
    Sam I am (as well as Confused at times).

  6. #6
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: 2 Dimesnion array with Dynamic Values

    People call me crazy because i'm jumping out of perfectly fine airplanes.
    I think they got it right! I've jumped (well, rapelled) out of several helicopters...much saner! :-)

    (82nd/101st/or hobbyist?)
    Sam I am (as well as Confused at times).

  7. #7
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: 2 Dimesnion array with Dynamic Values

    Quote Originally Posted by SamOscarBrown View Post
    I think they got it right! I've jumped (well, rapelled) out of several helicopters...much saner! :-)

    (82nd/101st/or hobbyist?)
    Hobbyist.
    Childhood dream turned into a passion 30 years after my childhood dream.
    If you want to take a look:
    https://www.dropbox.com/s/bz580aw28b...20Fun.mp4?dl=0
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  8. #8
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: 2 Dimesnion array with Dynamic Values

    cool....in Deutschland, yah? Sehr wunderschonen. (Sorry about the missing umlaut). Spend 8.5 years there. But not in the air!!!!!!!!!!!!!!!!!!
    Sam I am (as well as Confused at times).

  9. #9

    Thread Starter
    Member
    Join Date
    Apr 2016
    Posts
    46

    Re: 2 Dimesnion array with Dynamic Values

    Hi

    How to define an array for below code

    Make 2008 2009 2010 2011 2012
    Hyundai 0 0 14 5 0
    Tata 10 0 0 20 5

    Thanks

  10. #10
    Fanatic Member
    Join Date
    Feb 2017
    Posts
    858

    Re: 2 Dimesnion array with Dynamic Values

    Ramco:
    Is this homework?
    In the upper right corner is a search button. If you will type in "2D array" or "dimension 2D" you should get a lot of hits. Looking at your data, you might want a 3D not 2D.
    Before you go down this route, realize that ONLY the last dimension of a multi-dimensioned array with PRESERVE can be modified. HTH

  11. #11
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: 2 Dimesnion array with Dynamic Values

    1-What you wrote is NOT 'code'!!!!
    2-Do you know anything about arrays?
    Sam I am (as well as Confused at times).

  12. #12
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,057

    Re: 2 Dimesnion array with Dynamic Values

    the way you code it depends on where the data is coming from
    and what you are going to do with the data after.
    How you want to search it etc.

    at a minimum I would not use a 2d array. it would be better to use
    3 arrays in sync

    something like msgbox make(0) & " " & tata(0) would display "2008 10"

    I am sure this is still not the way I would code it but we only see a tiny slice
    of what you are doing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width