Correct order list from input


#1

Hello guys,

I am at the moment stuck on the following problem and I think there is a easy sulotion for this problem.

The problem is as followed at the moment the output is not in the same order as the input.

At the moment the output order is
0 LB
1 XX
2 XX
3 XX
4 XX

I want the same order as the input so OneLevelBased should be LB and CurverDriveStructrural should be XX

So the output order should be as followed:
0 XX
1 LB
2 XX
3 XX
4 XX

I am not searching for replacement beceause this is just a example for the output. The output can be everytime different this how the famillies are build.


#2

Hi,

I think there too few information here to be able to help you correctly… We do not have an order a priori, so what does

could mean for us ?

Anyway, here’s something I’ve done, not sure it will help you, but I hope it will :slight_smile:

2018-11-08%2015_34_22-Dynamo


#3

No sorry that wasn’t really where I was looking for…

We have a database that gives abbreviation to placement style of a family. This Dynamo script can read how the family is placed. But CurverDriveStructrural doen’t have abbreviation in our database for so I call it XX. Onelevelbased should be LB Twolevelbased is TBL and FaceBased should be FB etc.

The finding placementstyle and giving the correct abbreviation works but the problem is that mine output list order is different than the input list order that was I trying to make clear here above. The output order should be the same as the input order. I use this for renaming the family files so the input and output must be in the same order or the wrong file will get the wrong abbreviation

Here is a better example I hope

I can’t real show more of the Dynamo script because it is company related.


#4

Hi,

If I understand well, your final goal is to create a list that only contains abreviations ? For instance, say you have the bottom list you showed, the desired output would be somthing like : “VB, VB, VB, TLB, TLB, TLB, XX, etc.” ?

In that case, I don’t see why my solution doesn’t work for you (you know, you can have nested IF statements)

Otherwise, I don’t understand your problem at all.

__

Disgression :

I really think that there is some kind of logical misunderstading here. You cannot expect to re-order something if you do not define what oredered means.
I mean, it’s like if I said : “I have two totally independent lists, one containing numbers and the other parameter names. I shuffled the first one, and kept the second one. I now what to re-order the first one based on the second one, but I cannot define what re-order mean because I no longer know how was the first list in the first place”.

I don’t see why you have two lists in the first place, you should be capable of deducing the second one given only the first one.


#5

Rather than trying to reorder an existing list to match another, I think @mellouze is on the right track with replacing, except using a dictionary would be the easiest.

This only works in Dynamo 2.x+ as you need access to Dictionary nodes:


#6

Okay I used a little bit both of the solutions you gave me and I think I got it working now. I was making the lists to difficult with if statements reorder etc.

I cleaned everything this is what I got now.


#7

Glad you figured it out :slight_smile:

I think that your graph is still too complicated (here are some nodes that do not have all the inputs they require, there are probably some extra String From Object node), but the most important is that you have your desired output.


#8

Yeah I’m fixing that at the moment first priority was getting the correct output.

Many thanks again!


#9

Hello,
I was reading this chat and wonder if any of you guys can help me with a little problem:
I try to write a script for a " handshake"…meaning I collect instances of a host file and write the name, ID and location to an excel sheet. Simultaneously i want to get all instances from a linked file written in the same Excel sheet.

In the Excel Sheet I just apply a functions to look for duplicate values to identify miss matches. That way I can document the effort.

Well the whole exercise is done to track 2 Consultants work (wire /fixture ) where the wire guy ( Electrical) copies the fixtures from the fixture guy ( lighting) to have an attachment point for his wire… Ideally the original in the host file should have he same location like its copy in the linked file.

Copy/ monitor does not really work for us so we try to use a traceable schedule.
So here is my problem with the script:

The linked file gives me 3 lists of the parameters: name-ID-location ( list 1)
The host file gives me 1 list of combined parameters( name-ID-location) ( list 2)

my question :what node can i use change the order of list 1 to match the order of list 2?


#10

here is the schedule with miss matches


#11

Hi :slight_smile:

Looks like (List.Chop and) List.Transpose could help you here !


#12

hello mellouze,
I tried that with no success. Here is the larger picture:


#13

When you want to take a picture of an entire graph, zoom in until you can fully read a node and then hit the camera button in the top left, it will maintain the zoom level for the entire graph.

Can you show more of what your two outputs look like, maybe using a smaller data size. We cannot help you fix the structure if we cannot see the structure and the levels of the list.