Find length of an array embedded in a dictionary

What is the best way to determine the length of an array which is a member of a dictionary?

The length(array) or count(array) functions are frequently used to determine the length of an array or list of values.  But if the array is a member of a dictionary, these functions always return a length of one.

This test code illustrates the issue:

  a!localVariables(
    local!list: { "A", "B", "C" },
    local!emptyList: { },
    local!nestedList: { list: { "A", "B", "C" } },
    local!emptyNestedList: { list: { } },
    {
      "list" : {
        list: local!list,
        length: length(local!list),
        count: max(a!forEach(local!list, fv!itemCount))
      },
      "emptyList" : {
        list: local!emptyList,
        length: length(local!emptyList),
        count: max(a!forEach(local!emptyList, fv!itemCount))
      },
      "nestedList" : {
        list: local!nestedList.list,
        length: length(local!nestedList.list),
        count: max(a!forEach(local!nestedList.list, fv!itemCount))
      },
      "emptyNestedList" : {
        list: local!emptyNestedList.list,
        length: length(local!emptyNestedList.list),
        count: max(a!forEach(local!emptyNestedList.list, fv!itemCount))
      }
    }
  )

Test results:

Dictionary

    • list (Dictionary)
        • list (List of Text String) - 3 items
            • "A" (Text)
              • "B" (Text)
                • "C" (Text)
                • length: 3 (Number (Integer))
                  • count: 3 (Number (Decimal))
                  • emptyList (Dictionary)
                      • list (List of Variant) - 0 items
                        • length: 0 (Number (Integer))
                          • count: 0 (Number (Decimal))
                          • nestedList (Dictionary)
                              • list (List of Text String) - 3 items
                                  • "A" (Text)
                                    • "B" (Text)
                                      • "C" (Text)
                                      • length: 1 (Number (Integer))
                                        • count: 3 (Number (Decimal))
                                        • emptyNestedList (Dictionary)
                                            • list (List of Variant) - 0 items
                                              • length: 1 (Number (Integer))
                                                • count: 0 (Number (Decimal))

                                                Discussion posts and replies are publicly visible