+ Reply to Thread
Results 1 to 4 of 4

Data structure?

  1. #1
    Registered User
    Join Date
    02-27-2008
    Location
    Irving, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    96

    Question Data structure?

    Hi all. I have a pretty vague/broad question on which I am looking for learned advice. Being a mechanical engineer, my computer science skills are limited, and much of object oriented programming is trial-and-error for me. Regardless, I've managed to put together a pretty promising set of modules and userforms in Excel/VBA that are beginning to look like they'll work for what I need.

    I am trying to do an in-house document tracking and cataloging system. I've got zero budget, and that's why I went to VBA in Excel. At the root of the project is a need to know things about individual files, and to be able to search on one or more characteristics or tags for those files, both system created and user created. For example, I might like to find 3D drawing files created on a certain date (system created info), or those that apply to a particular manufacturer (user created info).

    I think that this is a situation in which some sort of array would be useful. For each file, I could make a new entry in a multi-dimensional array, with each entry representing a certain bit of information. Like this:

    Please Login or Register  to view this content.
    I'm not entirely sure that the Dim and ReDim is the proper way to declare the array, but it's the hack that I've gotten to work thus far. I'm not sure how to make the array persistent, though. I'd prefer not to have to re-build it every time the module is run, so I suppose I could also dump the array, value by value, into a spreadsheet/database file, and re-make it each time from there. That's a problem for further down the road.

    My question is this:

    Is an array the right way to store this data? I'm worried that if the data changes, say, if files are added to a folder that's being tracked and cataloged, then the old files' positions will be shifted and thus need to be managed very carefully. File 18 might now be file 19 because a new file with a higher alphabetically sorting placement was added. I have vague, fuzzy memories from my CS100 class that makes me wonder if there's not a better data structure to use. Could I make on Object (or Class??? or Function???, I'm not sure which might be right) that has Properties which can be defined and given a desired value? Maybe some pseudo code will illustrate my thinking:

    Please Login or Register  to view this content.
    It seems, though, that I'd still need some sort of array functionality in order to have one collection of properties for each individual design file. Like this, conceptually:

    Please Login or Register  to view this content.
    So, the bottom line is that I'm not very well versed on what the best approach is, but I think I could do a brute force array + database file system that would get there. I just wonder if there's a better, more programming-savvy method that I'm not aware of, but would really be the best fit for my project.

    I hope this has all made some amount of sense to people, and that someone can maybe offer some advice or point me in the direction of a useful resource. I really feel like this is a pretty obvious/common problem, and that I'm just not at the computer science guru level necessary to solve it elegantly.
    -Adam Hartman
    Mechanical Engineer

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    A user-defined data type would be a convenient structure:
    Please Login or Register  to view this content.
    A user-defined type can have any subset of data types, including (fixed-length) arrays.
    Last edited by shg; 04-15-2008 at 04:36 PM.

  3. #3
    Registered User
    Join Date
    02-27-2008
    Location
    Irving, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    96

    Genius!

    The title says it all! I was beginning to think I'd have to make some sort of alien pivot table, or get into Access and ODBC stuff

    This looks to be EXACTLY what I was thinking of! I'll give it a try and see what I get.

    Thank you immensely!

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    I don't do pivot tables, so you might not want to write that off as an alternative. But I find user-defined types convenient, and they may serve your purpose as well.

    You're welcome, good luck, and post back if you have problems.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1