get-collection-size() vs size() in LiveCycle

Just a note to be careful when using the XPath expressions get-collection-size() and size() in LiveCycle to count the number of elements in a list variable. If your list is empty the two functions will not return the same value

Creating a test process to demonstrate this I added three variables:

  • lstTestList
  • intCountList -> count(/process_data/lstTestList)
  • intCollectSizeList -> get-collection-size(/process_data/lstTestList)

Running this process on an empty list gives the following output:

  • intCountList -> 1
  • intCollectSizeList -> 0

So if trying to find out whether or not a list is empty use get-collection-size() and not count()

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s