Get Block Count

This is pre-built Action located under the @Generic Element Name. It instructs the Avo Assure Client to fetch the total number of the blocks that are present in Input Value and save the result in the given output variable.

Syntax

Input: <XML block/XML tags>;<block name>

Output: <Dynamic Variable>;<Dynamic Variable>(Optional)

Usecase/Example

Scenario: Testing API Response for Transaction History

You are working with a financial services API that is designed to provide users with their transaction history in XML format.

Consider a test case that involves sending a request to the API to retrieve the most recent 3 transactions for a specific user, identified by their user ID.

Input

// xml
<transactions>
  <transaction>
    <date>2024-01-01</date>
    <amount>1000.00</amount>
    <transactionId>TXN12345</transactionId>
  </transaction>
  <transaction>
    <date>2024-02-18</date>
    <amount>1200.00</amount>
    <transactionId>TXN76543</transactionId>
  </transaction>
  <transaction>
    <date>2024-03-01</date>
    <amount>1080.00</amount>
    <transactionId>TXN67890</transactionId>
  </transaction>
 </transactions>

Using the Action:

get block count Action will determine the number of <transaction> blocks present in the XML response.

Expected Result

This Action need to retrieve the count as 3 due to this XML block contains total 3 blocks in it.

Output

The result of this action is stored in the {result} output variable as 3, which can be utilized for display or other purposes.

Last updated

Was this helpful?