Skip to main content
Inspiring
May 29, 2024
Question

How to get list (dictionary) count ?

  • May 29, 2024
  • 20 replies
  • 11 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
Brainy
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
Brainy
May 29, 2024

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

शुभम्
mathieud0001
Brainy
May 29, 2024

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

Use length() function this should work.

venkatrea696188
Inspiring
May 31, 2024

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

Participating Frequently
May 31, 2024

My bad.

prasantap0900
Participating Frequently
August 1, 2024

Please check the difference.