Total count of rebar in active view

Hello,
Im new in Dynamo. Im trying to count all the rebar from active view, sort them after rebar number and then extract with the help of an parameter the total value of rebar witch similar rebar number. My script work correctly inside Dynamo but it not send to Revit the correct information. Could somoane tell me what my script is missing or wrong?
Thanks in advance.

what you did on your graph was to set a value to “Cantitate Totala” parameter. If you’re just counting, you can do it on schedule since you already know the parameter you were looking for. Let me know if I misinterpreted what you really need.

Yes, i can do that in a schedule by using parameter Quantity and set him to calculate totals. But what i wanted is to create a tag using a parameter that is doing the similar thing. I am looking after the value from the column C as you can see in the attached image. That should correspond to each rebar number from column A. the problem is that after i run the script the value in the parameter are somehow messed up in a way that it not reflect what the schedule it show.

Because the list of element (20) and value (11) is not equal

1 Like

Thank you very much newshunhk. Your explanation helped me to waste time on this. Can you explain me what that step is doing, i `m curious to know and learn way it is necessary. Also i will upload an image of the scrip to help every one else
that is looking for something similar.

because you use groupbykey to group the value into piece, so you also need to group the source (elements) to be same group also, otherwise they wont match.