Skip to main content
Inspiring
May 29, 2024 8:48 AM UTC
Question

How to get list (dictionary) count ?

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
Brainy
May 29, 2024 8:53 AM UTC

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 8:55 AM UTC

shubhama926776
Brainy
May 29, 2024 8:58 AM UTC

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

शुभम्
mathieud0001
Genius
May 29, 2024 11:57 AM UTC

a!flatten works for me.

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

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

Participating Frequently
May 31, 2024 5:22 AM UTC

Use length() function this should work.

venkatrea696188
Inspiring
May 31, 2024 5:26 AM UTC

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

Participating Frequently
May 31, 2024 5:30 AM UTC

My bad.

prasantap0900
Participating Frequently
Aug 1, 2024 7:32 AM UTC

Please check the difference.