Any idea of vb code to assign hierarchy level of a big amount of rows?

Igor I
Igor I
edited 03/12/24 in API & Developers

I try to organize a 2000 rows hierarchly, depneding on level 0 (root), 1, 2 and so on.

Made it row by row but it took so much time and smartsheet seems to time out giving me errors. I can't send bulk rows update because it says that rows must have same row parent id, sibling id, ecc... but in my case level 1 ha 0 as parent and the second level 1 ha the previous level 1 as a sibling. Anyone had same problem? any suggestion?



  • Genevieve P.
    Genevieve P. Employee Admin

    Hey @Igor I

    I'm not sure I quite understand what you're looking to do, but if you're looking to have a number appear next to a row to indicate its "Level" (hierarchy), I would personally suggest using a Column Formula instead. Here are some related Community posts that show that type of formula:



  • Ciao

    I understand what you’re suggesting, but it’s not what I mean. I’m looking for a routine that, given a list of activities already organized by level, indents the corresponding row based on the value in the ‘level’ column. This way, the large list will have a collapsible hierarchical structure.

    I already have a routine that does this, but it processes row by row and takes hours. I would like to send the hierarchy in bulk so that the sheet updates more quickly.

  • MichaelTCA
    MichaelTCA ✭✭✭✭✭✭

    Hello @Igor I

    Here's the types of code that Smartsheet API will recognize.

    So you have me curious now. Where are you running the macros?

  • Hi Michael,

    I konw the link you posted, but didn't find what I searching for...

    I use on visual studio. I'm old old school programmer and use visual basic as a self made coder. It fits my needs and helped me many times to connect different situations in the company where I work. I use smartsheet as a portal for many situations regarding manufacturing our projects and publish results for sales force or production guys.

  • MichaelTCA
    MichaelTCA ✭✭✭✭✭✭
    edited 04/04/24

    @Igor I

    I use visual studio too. No worries.

    Ahh makes sense since you are using sales force.

    Not sure if this will help.

    This is an example from an excel sheet I use. I only have 2 columns I need in the file, which is why I used Cell(row,2) in the conditional statement. This spits out row by row, but if you create the collection first and then use something like this example, you can use your bulk method.

    You can use these functions to analyze the data in a hierarchal format of collections.