Skip to main content
Inspiring
May 29, 2024
Question

How to get list (dictionary) count ?

  • May 29, 2024
  • 20 replies
  • 0 views

Hi all,

I have a list and the count of this list is 15 once i try to use count isn't return 15 it returns 1 also I tried to use a!flatten but the same issues 

any advice ?

20 replies

shubhama926776
May 29, 2024

Your list might be nested (lists within lists). count() only counts top-level items.
Your main dictionary contains 15 sub dictionary items
By Flatten your list, making it appear like one list.

You have to use "." notation to access sub dictionary.
.parameters

Share code for better visualisation

alaaa6815Author
Inspiring
May 29, 2024

shubhama926776
May 29, 2024

Use this
count(local!stored.parameters.IO_CURSOR)

mathieud0001
May 29, 2024

a!flatten works for me.

count(a!flatten(local!stored.parameters.IO_CURSOR))

count() or length() could both be used here.

May 31, 2024

Use length() function this should work.

venkatrea696188
May 31, 2024

Sorry , Len() is for a finding number of characters in a text, It's not used for list 

May 31, 2024

My bad.

prasantap0900
August 1, 2024

Please check the difference.