<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to query an Experiment.SC ? in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588015#M84592</link>
    <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Something like this will work:&lt;/P&gt;&lt;PRE&gt;Table.query("SELECT * FROM Experiment.[Staytime Collector]").cloneTo(Table("GlobalTable1"))&lt;/PRE&gt;&lt;P&gt;You can just construct the string using the stats collector name - you don't need it as a parameter:&lt;/P&gt;&lt;PRE&gt;Object sc=Model.find("Tools/StatisticsCollectors/Staytime Collector");
Table.query("SELECT * FROM Experiment.["+ sc.name+"]").cloneTo(Table("GlobalTable1"));&lt;/PRE&gt;&lt;P&gt;You may want to join the taskid on the tasks and scenarios tables to get more useful fields.&lt;/P&gt;&lt;/DIV&gt;</description>
    <pubDate>Tue, 07 Nov 2023 16:14:34 GMT</pubDate>
    <dc:creator>jason_lightfoot_adsk</dc:creator>
    <dc:date>2023-11-07T16:14:34Z</dc:date>
    <item>
      <title>How to query an Experiment.SC ?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588014#M84591</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 23.2.2 ]&lt;/I&gt;&lt;/P&gt;&lt;DIV class="fr-view clearfix"&gt;
 &lt;P&gt;How to passe an Experiment.StatisticCollector table as a parameter in a query ?&lt;/P&gt;
 &lt;PRE&gt;Table FromTable   = ??? 

/*1)*/ Table Query = Table.query("SELECT * FROM Experiment.SC");
/*2)*/ Table Query = Table.query("SELECT * FROM $1",FromTable);
Query.cloneTo(TableResult);&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Nov 2023 14:06:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588014#M84591</guid>
      <dc:creator>nicolas_membrez4BM5L</dc:creator>
      <dc:date>2023-11-07T14:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to query an Experiment.SC ?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588015#M84592</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Something like this will work:&lt;/P&gt;&lt;PRE&gt;Table.query("SELECT * FROM Experiment.[Staytime Collector]").cloneTo(Table("GlobalTable1"))&lt;/PRE&gt;&lt;P&gt;You can just construct the string using the stats collector name - you don't need it as a parameter:&lt;/P&gt;&lt;PRE&gt;Object sc=Model.find("Tools/StatisticsCollectors/Staytime Collector");
Table.query("SELECT * FROM Experiment.["+ sc.name+"]").cloneTo(Table("GlobalTable1"));&lt;/PRE&gt;&lt;P&gt;You may want to join the taskid on the tasks and scenarios tables to get more useful fields.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Nov 2023 16:14:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588015#M84592</guid>
      <dc:creator>jason_lightfoot_adsk</dc:creator>
      <dc:date>2023-11-07T16:14:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to query an Experiment.SC ?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588016#M84593</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;&lt;P&gt;Option one is the correct way to query an experiment table:&lt;/P&gt;&lt;PRE&gt;/*1)*/ Table Query = Table.query("SELECT * FROM Experiment.SC");
&lt;/PRE&gt;&lt;P&gt;It is very common that the table name needs brackets:&lt;/P&gt;&lt;PRE&gt;Table Query = Table.query("SELECT * FROM Experiment.[SC]");&lt;/PRE&gt;&lt;P&gt;It is usually unnecessary to pass the table as a parameter, as FlexSim supports nested queries:&lt;/P&gt;&lt;PRE&gt;SELECT ... FROM (SELECT a, b, c FROM Experiment.SC WHERE ...)&lt;/PRE&gt;&lt;P&gt;If you really need to query a custom data structure (which could include a table), you can use placeholders and $iter():&lt;/P&gt;&lt;PRE&gt;Table fromTable = Table("GlobalTable1");
Table result = Table.query("SELECT $2 AS Col1, $3 AS Col2 FROM $1"
    , fromTable.numRows         /*pass in the number of rows in your table*/
    , fromTable[$iter(1)][1]    /*use $iter(1) to access the nth row*/
    , fromTable[$iter(1)][2]
);
result.cloneTo(Table("GlobalTable2"));&lt;/PRE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Nov 2023 16:24:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588016#M84593</guid>
      <dc:creator>JordanLJohnson</dc:creator>
      <dc:date>2023-11-07T16:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to query an Experiment.SC ?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588017#M84594</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 It was exactly my need, thanks a lot
&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Nov 2023 17:39:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588017#M84594</guid>
      <dc:creator>nicolas_membrez4BM5L</dc:creator>
      <dc:date>2023-11-07T17:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to query an Experiment.SC ?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588018#M84595</link>
      <description>&lt;DIV class="fr-view clearfix"&gt;
 Thanks a lot for the explanations ! I have to study this !
&lt;/DIV&gt;</description>
      <pubDate>Tue, 07 Nov 2023 17:40:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-query-an-experiment-sc/m-p/13588018#M84595</guid>
      <dc:creator>nicolas_membrez4BM5L</dc:creator>
      <dc:date>2023-11-07T17:40:21Z</dc:date>
    </item>
  </channel>
</rss>

