Wednesday, April 6, 2011

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()

No comments:

Post a Comment