Skip to main content
Solved

Strange issue with SQL query within workflows

  • Nov 12, 2024 5:24 PM UTC
  • 1 reply
  • 84 views

christopherlecky
Explorer
Forum|alt.badge.img+21

When I run the following query in SQL it returns a single value that is an XML representation of the client list.

SELECT 
[Client].[Id] 'ClientId',
[Client].[name] 'ClientName',
[Client].[net_hostname] 'ClientHostName'
FROM
[CommServ].[dbo].[APP_Client] AS [Client]
WHERE
[Client].[status] = 2
FOR XML RAW, ROOT('ClientInfo');

The goal is to use xpath to do queries against the list rather then doing constant queries.

 

The problem is that when I run it in a workflow it looks like it paginates the results so it returns multiple rows.

 

Is there another way to do this? 

 

Best answer by Pradeep

Hi ​@christopherlecky 

Commvault Workflows execute an XPath query Usually via XML Query activity or script, and the input XML contains a list, the workflow engine may iterate over each matching node as rows, not aggregate them as one array or list.

This can look like pagination, but it's really row-wise iteration, depending on how the For each or activity is configured. Try to Set the output as a variable of type List or XML

View original
If you have a question or comment, please create a topic

1 reply

Forum|alt.badge.img+17
  • Vaulter
  • Answer
  • Jul 11, 2025 5:07 AM UTC

Hi ​@christopherlecky 

Commvault Workflows execute an XPath query Usually via XML Query activity or script, and the input XML contains a list, the workflow engine may iterate over each matching node as rows, not aggregate them as one array or list.

This can look like pagination, but it's really row-wise iteration, depending on how the For each or activity is configured. Try to Set the output as a variable of type List or XML