Combine 2 Lists of Strings with a separator


#1

Hi!

I want to combine these two lists of strings. The first item of the first list is added at the end of the first item of the second.

How can I add a “.” separator in this case?

Thanks!


Insert parameters of type elements contained in a room in the instance parameters of a room
#2


#3


#4

Thanks @Vikram_Subbaiah, it is really interesting how you use the String.Join with Long Lacing for the separator only before plug it into the List.Combine.


#5

@Einar_Raknes thanks for your approach. I´m really keen on learning more about creating those kind of statements using Code Block.


#6

It is not so difficult. You just put a + (plus sign) between each part you want to join. Strings are quoted with “”.
list a + separator + list b.

Another example:


#7

Great!

@Einar_Raknes is it possible to set the Lacing type (short, long, cross) within the Code Block?

What if in the graph above I wanted the lists to read like this: 1.A, 2.A, 3.A and the second list like: 20.B, 21.B, 22.C


#8

@Pablo_Perez_Valdivia

You need to use Replication guides to change lacing in code blocks:


Merge lists with lists with same index
#9

@Pablo_Perez_Valdivia
Yes, like Kulkul says: You have to use replication guides:


Sub-List Cross Lacing... is it possible?
Merge two list into one
#10

@Kulkul, @Einar_Raknes, thanks guys, really valuable stuff. I´ve learnt a lot.

Again, I´m getting closer and closer and then a new question comes up. In the following graph I´ve highlighted in pink the first problem: How can I add the elements of List_B to the end of each subelement of List_A.

The second problem, as you can see, is that I set the Mark parameter values, then I change them, and then I set them again. This sounds a bit weird and I´m wondering if I could get the same results using just one Set.Parameter node (by wise-management the lists).


#11


#12

One possible solution to you second problem @Pablo_Perez_Valdivia


#13

Hi @Vikram_Subbaiah, that works perfect!!!

@Einar_Raknes, I realized that I already had the list of elements upstream (Watch node on the left), so I can Set.Parameter in just one go.

Here the result:

BTW: This is the end part of a larger Definition that identifies the Area a door belongs to and then set the Area Number parameter + integer as the Door Mark (ie 0.03.4 means Door 4 in Area 0.03).

Node party:


#14

Hi, Could you please help me? I tried to follow the solution here, but it doesn’t work…anyone knows why?


I have the two strings lists, I want to combine them with Hyphen in between…


#15

@LAURA.ELENA.DIANU
Not sure why, seems to work fine on mine.
are they actually strings?