Use output data from one Query in another query

Hi,

I need to use my sku data i get from my first query in the second query. But i dont get it right.
Please look at the Screenshot.

I thought it would be possible to use something like {{Hole_Umlagerungen.data.sku}}
But it does not work and i did not find any usable solution.

it looks like Hole_Umlagerungen could be returning an array of objects.

in query1, you should be able to map that array to get the list of skus.
try something like
{{Hole_Umlagerungen.data.map(e => e.sku)}}
or if that doesnt work you could try
{{formatDataAsObject(Hole_Umlagerungen.data).sku}}

Thanks matthewej. It worked to get the skus but i think it is not formatted in the right way.
The query does not return any data.

When i hover over the {{Hole_Umlagerungen.data.map(e => e.sku)}} i get the following output: [ "Art-56789-fba", "Art-51598", "Art-51598-sl", "Art-56772-de-fba" ]

But for sql it should be:

  'Art-56789-fba',
  'Art-51598',
 'Art-51598-sl',
  'Art-56772-de-fba'

If query1 is using a Microsoft SQL Server resource, you can join the sku javascript array into a singular string and then use the SQL string_split function. That would look like

SELECT
  BestandVerfuegbar
FROM
  ArtikelVerwaltung.vArtikelliste
WHERE Artikelnummer IN (
  select VALUE FROM string_split({{Hole_Umlagerungen.data.map(e => e.sku).join(",")}}, ',') 
)
AND kFirma = 1;

If query1 is using a different version of SQL, you could try a partial match using LIKE compared to the javascript string

WHERE {{Hole_Umlagerungen.data.map(e => e.sku).join(",")}} LIKE '%' + Artikelnummer + '%'

You need to indicate which column in the Hole_Umlagerungen.data you want to find Atrikelnumner in.

If, as it seems from your description, you want it in SKU, try where Atrikelnumner = any(Hole_Umlagerungen.data.sku). The syntax is a bit different when you are searching in an array ANY([...]) vs a string list of values IN (...).