List: Combining Lists

Hi, I’m working on a script that uses a selection of rooms and places elevations. I need help combining the scripts of selected rooms I made with a scripts of elevations (broken down per room).

So it should read [room name][elevation]. For example

  • 0 LIST
    • ROOM100 - WEST
    • ROOM100 - NORTH
    • ROOM100 - EAST
    • ROOM100 - SOUTH
  • 1 LIST
    • ROOM101 - WEST
    • ROOM101 - NORTH
    • ROOM101 - EAST
    • ROOM101 - SOUTH

Here is an image of the script so far. as you can see I’m renaming the indices to the cardinal points so that eventually I can name my views accordingly.

Providing for context only, i just need to know how to combine the two lists of scripts at the end please.


R

and this is what happens when i combine them

I already mentioned this in your previous post, but you’re almost always better off using list levels over List.Combine or List.Map. At least until you understand how list levels work and where function mapping makes a difference.

Are you wanting lists or are you wanting combined strings like in the example you show? Using a + node or a code block is the easiest way to combine strings. List levels with the node will get you exactly what you want. In your case, since the combinator is always the same " - ", it’s easier just to include that in the suffix.

Right, that is what I also did but it didn’t work.

This is what I got. It should read like the example:

  • 0 LIST
    • ROOM100 - WEST
    • ROOM100 - NORTH
    • ROOM100 - EAST
    • ROOM100 - SOUTH
  • 1 LIST
    • ROOM101 - WEST
    • ROOM101 - NORTH
    • ROOM101 - EAST
    • ROOM101 - SOUTH

First, you want to use the values from the dictionary, not the dictionary itself. Second, you need to provide list levels to specify how the lists should be treated when iterating over the + node.

Okay, so based on what you said i did this instead and I think its what I’ll need to move forward.

Thanks!

Because you already have matching lists, you don’t actually need to use list levels, I forgot to mention that part. So, yes, this works perfectly.

You could also use one list of suffixes for all rooms and list levels (@L1) to get the same output.

I was trying to get this earlier but I dont have an understanding of the syntax. thanks a lot!

Alright, I tired using levels but It didnt work so I tried mapping and it worked! but I have no clue why, it was all just trial and error.

All I can see from that screenshot is that you have mismatched lists. The list of views has 4 levels and the list of names has 3 levels. We’d have to see what you did previously to get the lists like that.