4 Replies Latest reply on May 20, 2011 4:55 AM by Barry LaFond

    User defined functions in Teiid

    Mathangi Pichai Newbie

      Hi,

       

      I have few UDF's in MMX and i am trying to implement the same in Teiid. I followed the procedures as per the documentation available for Teiid UDF. In MMX there is a seperate tab for UDF in the designer and we create a new scalar function in there. Also we can use the UDF in the transformation query and verify the query atleast for syntax in the local designer.

       

      I want to test something similar to this in teiid and so I have created the function as a function metadata model. I have not deployed the jar in the server. I just want to ensure that the syntax for the function is right and there are no issues in the way it is being called in the query in my designer. But when I try to do this i get the following error-

       

      The query is parsable but not resolvable.

      Resolver Error: Error Code:ERR.015.008.0039 Message:The function 'GetObjectName(H.Object1Id, H.Object1Type, H.Object1RepositoryId)' is an unknown form. Check that the function name and number of arguments is correct.

      Is this even a right way of checking this in Teiid? I have attached a screen print of the UDF in my designer.

      Thanks,

      Mathangi

        • 1. User defined functions in Teiid
          Ramesh Reddy Master

          Mathangi,

           

          That should be all you need be doing in the Designer. Create a function model, and create function definition and use it in the other view transformations. The only thing specific you need to do is when you are building the VDB, you need to explicitly add the function model to the VDB, it is not automatically added. Also deploy the jar to the Teiid/Jboss AS server.

           

          If you want you can attach you VDB, we can take look to see what is wrong. Also what version of the Designer you are using?

           

          Ramesh..

          • 2. User defined functions in Teiid
            Mathangi Pichai Newbie

            Hi Ramesh,

             

            I am using Teiid 7.1.0. I had not added the model to the vdb, since I just wanted the query to be properly validated in the transformation editor even before adding it to the vdb. Also do we have to change the way we are calling the function in the query? Previosuly in MMX we used to just write the function name in the query. But now since we have a model (.xmi) for the function do we have to access it by giving a fully qualified name?

             

            Thanks,

            Mathangi

            • 3. User defined functions in Teiid
              Ramesh Reddy Master

              Mathangi,

               

              It is no different in terms of use from Metamatrix. You do not have to fully qualify it. I suggest may be try a new version of the Teiid Designer, see that fixes your issue.

               

              Thanks

               

              Ramesh..

              • 4. User defined functions in Teiid
                Barry LaFond Master

                Mathangi.

                 

                In Teiid Designer 7.1, your custom functions should be available in the Transformation Editor's Expression Builder dialog.  If not, you can try restarting Teiid Designer which should load all existing custom functions into Teiid Designer's function library.

                 

                In the upcoming 7.4 release, we've fixed this issue and improved the user experience for Function models including adding them as dependencies to View models AND to automatically add them to VDB's, similar to other dependent models. See: http://issues.jboss.org/browse/TEIIDDES-941

                 

                We'll have another milestone available next week for 7.4

                 

                Barry