cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get the total number of items in an array

Sean.Davey
Builder

I am looking to get the total number of items in an array, so in the example below the data collect would display the number 9.  Does anyone know a good getter chain for this.  So far everything I have tried hasnt worked

 

Thanks

 

[<QueryResultSet>
<Metadata>
<Column name="cvcId" type="java.lang.Long"/>
<Column name="owner" type="java.lang.String"/>
<Column name="groupName" type="java.lang.String"/>
<Column name="opsName" type="java.lang.String"/>
<Column name="cvcType" type="java.lang.String"/>
<Column name="claimSystemId" type="java.lang.Long"/>
<Column name="hccClaimNumber" type="java.lang.String"/>
<Column name="receiptDate" type="java.sql.Date"/>
<Column name="claimType" type="java.lang.String"/>

3 REPLIES 3

Mario.Morelli
Architect

Hi

 

You should be able to use the below

 

toString().split(Column).length

 

Just check the value, I will double check but I think this getter chain returns the array count+1 for some reason.

 

Ciao



Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

Learn more about me in the Community Member Spotlight Q & A

Thanks Mario.

 

This seems to have worked...How do I get it so that it will only look at that one section of the array and not go to other data being pulled?

 

Thanks

Hi Sean

 

You will have to provide a bit more context as to what the entire data structure is that will be queried.

Is it always the same data structure, with different values?

 

Meaning is the array always in a certain section of the returned data, where would be the start and end pieces in the data to better answer your question.

 

Ciao



Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.

Learn more about me in the Community Member Spotlight Q & A
On-Demand Webinar
Discover new Splunk integrations and AI innovations for Cisco AppDynamics.


Register Now!

Observe and Explore
Dive into our Community Blog for the Latest Insights and Updates!


Read the blog here