Get Block Value
Last updated
Last updated
This is pre-built Action located under the @Generic Element Name. It instructs the Avo Assure Client to fetch the value of the XML block and save the result in the given output variable.
Input: <XML tag name>; <index of block name>; <block name>
Output: <Dynamic Variable>;<Dynamic Variable>(Optional)
When you are testing a financial services API that returns a user's transaction history in XML format. It's important to verify that not only the correct number of transaction blocks is returned, but also that the values within those blocks are accurate.
Testing Example:
You send a request to the API to retrieve the latest 4 transactions for a specific user and want to extract specific block values from the XML response. In this scenario user wants to fetch the value of 2 child blocks from parents block by providing parents block name.
Input:
xml
<transactions>
<transaction>
<date>2024-10-01</date>
<amount>100.00</amount>
<transactionId>TXN12345</transactionId>
</transaction>
<transaction>
<date>2024-09-30</date>
<amount>150.00</amount>
<transactionId>TXN12344</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:
You will use the get value Action to extract specific values from the XML blocks, such as the 2 transaction blocks.
Expected Result:
This Action needs to retrieve two child blocks from the desired parent block by providing parents block name.
Output: The result of this Action is stored in the {result} output variable as
<transaction>
<date>2024-09-30</date>
<amount>150.00</amount>
<transactionId>TXN12344</transactionId>
</transaction>
which can be utilized for display or other purposes.