1 Reply Latest reply on Apr 25, 2017 10:33 AM by Steven Hawkins

    Does teiid has  ODATA support for aggregation functions. Is there any other way to pass GROUP BY {parameter} dynamically through an application request

    Sanjeewa Ranasinghe Newbie

      I want to use a group by query against a data source, but the group by {column} needs to be dynamically passed through a application request. I did not found any document regarding ODATA support for this. Is this a limitation.

      I tried to use a virtual procedure as a REST service but it didnt' also work. fallowing is the code.

       

      <model name="View" type ="VIRTUAL">

               <metadata type="DDL"><![CDATA[

                  SET NAMESPACE 'http://teiid.org/rest' AS REST;

                  CREATE VIRTUAL PROCEDURE g1Table(IN p1 string) RETURNS TABLE(xml_out xml) OPTIONS (UPDATECOUNT 0, "REST:METHOD" 'GET', "REST:URI" 'g1/{p1}')

                  AS

                  BEGIN

                      SELECT XMLELEMENT(NAME "rows", XMLATTRIBUTES (g1Table.p1 as p1), XMLAGG(XMLELEMENT(NAME "row", XMLFOREST(ID, EMPNAME)))) AS xml_out FROM testDataSource.testTb group by (p1);

                     

                  END

                  ]]>

                  </metadata>

      </model>

       

      here although I passed the parameter p1 through the HTTP request,it doesn't work.