Hello,
I have written the SQL code below. It works fine but it needs to copy the Table Data to Global Table test using cloneTo().
Object buffer = model.find(token.ZalAdr); Table Data = Table.query("SELECT Bin, ROW_NUMBER() AS NrRow FROM $1 AS Distance", buffer.labels["Default"]); Data.cloneTo("test"); token.SKU = string.fromNum(token.SKU); Table Result = Table.query("SELECT * FROM test AS R, Biny AS B \ WHERE \ SKU = $1.SKU \ AND R.Bin = B.Bin \ ORDER BY \ Data ASC, Field ASC, NrRow ASC", token); token.BinName = Result[1][1];
1. Is it possible to create a subquery (Table Data) using a $ alias in the Table result?
Something like this (not working):
Object buffer = model.find(token.ZalAdr); token.SKU = string.fromNum(token.SKU); Table Result = Table.query("SELECT * FROM $1.query("SELECT Bin, ROW_NUMBER() AS NrRow FROM $1 AS Distance", buffer.labels["Default"]) AS R, Biny AS B \ WHERE \ SKU = $2.SKU \ AND R.Bin = B.Bin \ ORDER BY \ Data ASC, Field ASC, NrRow ASC", Table, token); token.BinName = Result[1][1];
2. Is it possible to refer directly to the Table Data without using cloneTo()?
Unfortuanately, I am not allowed to publish the simulation model.