Forum de la communauté Allplan

[Question] Node Group items by ID [Résolu]

Balises:
  • Allplan
  • 2022
  • Visual
  • Scripting
  • Node

Hello everyone,

I have a question:

I want to create sublists of different ID's. I use exactly the same excel file for the ReadPoints node as for the ReadTable node. The csv is sorted by ID number and sublists are created, but this does not work with the ReadTable node and then GroupitemsByID node.

Can someone tell me what I'm doing wrong and still can get my excel grouped by ID?

Pièces-jointes (3)

Type: image/png
Téléchargé 44 fois
Size: 5,34 KiB
Type: image/png
Téléchargé 41 fois
Size: 42,84 KiB
Type: image/png
Téléchargé 50 fois
Size: 36,11 KiB

Show solution Hide solution

To use the Node GroupItemsByID, you have to prepare two lists. One list for IDs, another one for the items to be grouped. It will rearrange the item list based on its ID accordingly. Currently, it won't work, if both lists have different size.


This is how it works:
Let's assume you have one ID list:
0 A
1 B
2 B

And one list to be grouped:

0 Point0
1 Point1
2 Point2

You will get a 2-d list as a result:

0 ## for ID = A
└─0 Point0
1 ## for ID = B
├─0 Point1
└─1 Point2

Check the attachted screenshot for better understanding.

Product Owner API, Allplan GmbH

Pièces-jointes (1)

Type: image/png
Téléchargé 97 fois
Size: 143,13 KiB

To use the Node GroupItemsByID, you have to prepare two lists. One list for IDs, another one for the items to be grouped. It will rearrange the item list based on its ID accordingly. Currently, it won't work, if both lists have different size.


This is how it works:
Let's assume you have one ID list:
0 A
1 B
2 B

And one list to be grouped:

0 Point0
1 Point1
2 Point2

You will get a 2-d list as a result:

0 ## for ID = A
└─0 Point0
1 ## for ID = B
├─0 Point1
└─1 Point2

Check the attachted screenshot for better understanding.

Product Owner API, Allplan GmbH

Pièces-jointes (1)

Type: image/png
Téléchargé 97 fois
Size: 143,13 KiB

Thank you, it works!