REST API - Session Relevance Query - Rotate multiple items to multiple rows?

Hi

For a query that is returning multiple items, I was wondering if the results can be rotated into multiple rows instead. For example from:

PC1, item0, item1, item2
PC2, item0, item1, item2

rotating the output to:

PC1, item0
PC1, item1
PC1, item2
PC2, item0
PC2, item1
PC2, item2

The actual script I’m working with is:

(
  item 0 of it,
  item 1 of it,
  item 2 of it,
  item 3 of it,
  item 4 of it,
  item 5 of it,
  item 6 of it,
  item 7 of it
)
of (
  name of it,
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2000 and MSDE 2.0") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2005 and Express") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2008 and Express") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2008 R2 and Express") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2012 and Express") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2014 and Express") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 7.0 and MSDE 1.0") of it | "")
)
of bes computers

This produces the output like the following:

PC01, , , , , , Microsoft SQL Server 2014 Developer Edition (MSSQLSERVER) | 12.0.2000.8 | Gold, 
PC02, , Microsoft SQL Server 2005 Express Edition (SQL2005) | 9.00.4035.00 | Service Pack 3, Microsoft SQL Server 2008 Express Edition (SQL2008) | 10.0.1600.22 | Gold, Microsoft SQL Server 2008 R2 Express Edition (SQL2008R2) | 10.50.1600.1 | Gold, Microsoft SQL Server 2012 Express Edition (SQL2012) | 11.0.2100.60 | Gold, , 

But I would like to express it like the following:

PC01, Microsoft SQL Server 2014 Developer Edition (MSSQLSERVER) | 12.0.2000.8 | Gold
PC02, Microsoft SQL Server 2005 Express Edition (SQL2005) | 9.00.4035.00 | Service Pack 3
PC02, Microsoft SQL Server 2008 Express Edition (SQL2008) | 10.0.1600.22 | Gold
PC02, Microsoft SQL Server 2008 R2 Express Edition (SQL2008R2) | 10.50.1600.1 | Gold
PC02, Microsoft SQL Server 2012 Express Edition (SQL2012) | 11.0.2100.60 | Gold

Thanks in advance.

Gary

Try this:

(
  item 0 of it & ", " & item 1 of it;
  item 0 of it & ", " & item 2 of it;
  item 0 of it & ", " & item 3 of it;
  item 0 of it & ", " & item 4 of it;
  item 0 of it & ", " & item 5 of it;
  item 0 of it & ", " & item 6 of it;
  item 0 of it & ", " & item 7 of it
)
of (
  name of it,
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2000 and MSDE 2.0") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2005 and Express") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2008 and Express") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2008 R2 and Express") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2012 and Express") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 2014 and Express") of it | ""),
  ((if it equals "N/A" then "" else it) of value of results from (bes properties "SQL Server 7.0 and MSDE 1.0") of it | "")
)
of bes computers
2 Likes

Thanks @jgstew, that’s just what I needed. :relaxed:

Cheers

Gary

2 Likes