Creating a relationship between an OpenEdge External object and a Native Rollbase object - Forum - Rollbase - Progress Community

Creating a relationship between an OpenEdge External object and a Native Rollbase object

 Forum

Creating a relationship between an OpenEdge External object and a Native Rollbase object

  • It is possible to create a relationship and to attach the right records between an external object (openEdge) and a native rollbase object from the UI. But if we want to use this logic in object script triggers, how can we set the relationship? After creating a record in OpenEdge, an ID will be generated by OpenEdge. We want to use this ID for the relationship with the native Rollbase object. After some testing within the object script triggers, we are struggling to catch the ID, it remains empty. We've created also a second trigger (on create) to get the ID. It looks like that we can not use the SelectNumber or SelectQuery APIs. it looks like that the query API's are not supported for external tables, is that true?

    How can we achieve this? 

  • Hi bakar,

    Yes, it is possible to create a native Rollbase Object into your OE external object, i tried creating one to my User object and OE external object. One thing I notice I am limited to "1 OE obj : 1 RB obj" and "1 OE obj : N RB obj".

    it looks like that the query API's are not supported for external tables, is that true?
     - I think yes, that you cannot use selectQuery, when I tried it I receive an error "Object imported from OpenEdge service do not support Query API (line #3)"

    To query on OE object use rbv_api.getRelatedFields2 and rbv_api.getRelatedIds2, I have sample code below which I place the code from USER object and Query into my OE related object. 

    if("{!R192514}" != "") {
       var x = rbv_api.getRelatedFields2("R192514", "eCustomer", {!R192514#id}, "Phone");
       for(i=0; i<x.length; i++) {
          rbv_api.println(x[i]);
       }
    }
    


    Hope this may help.

    Regards,

    Orchid

  • Hi Orchid,

    Thanks for your reply. The issue is that we haven't set the relationship, so we can not use getrelatedid or get related fields api. Let me put the customers req:

    The Person table is an external table in OE and we have a 1:1 relation with the user object (native rollbase table)

    - create a new record in the Person table (external table in open edge) within rollbase

    - after creation we need to create a USER in Rollbase

    - we need to put the relationship between these two records

    We can create the record in OE and also create the user in rollbase with an object script trigger. The issue is the relationship. How can we get the ID from the Person table and attach both records together?

  • OpenEdge objects do not support Query APIs due to system limitations.

    Can you use template tokens like {!id} ?

  • No, unfortunately....

  • You can use the template tokens, but you can not catch the Id, since this column doesn't exist in open edge. I have the person id and want to catch this AFTER  the creation

  • Are you creating OE record in trigger? I'm still not sure where the problem is.

  • No I'm creating the records within rollbase. We have attached the object as an external table. From here if we create a new record, the record will be created in OE. We have also a relationship with a native rollbase object (User) and we want to setup this relationship automatically. I can not get the ID from the external object, since I cannot use the selectquery APIs.

    If we use the after create object script trigger, the person id will remain empty (in the trigger). But on the user interface we can see the ID which has been generated by OE.

  • OK, let us discuss this internally.

  • WRT
    > we can not use the SelectNumber of SelectQuery API. it looks like that the query API's are not supported for external tables, is that true?

    Yes, OpenEdge Service Objects cannot use the APIs that rely on SQL queries ( so you cannot use selectQuery, selectNumber, etc )=
  • Tracking as PSC00328762. "After create" triggers should have access to auto-generated ID through template tokens.

  • Thanks Pavel, Im facing also another issue: when you publish an app which contains a relationship between a native rollbase object and an external object, the following error message will be shown when trying to install the application:

    java.lang.ClassCastException: com.rb.core.data.definition.FieldPrimaryKey2 cannot be cast to com.rb.core.data.definition.FieldPrimaryKey

    at p0.a413.fixProperties2(a413.java:2105)

    at p0.a413.install(a413.java:340)

    at p0.a413.install(a413.java:183)

    at com.rb.prod.logics.servlet.ComponentServlet.doGet(ComponentServlet.java:261)

    at com.rb.prod.logics.servlet.ComponentServlet.doPost(ComponentServlet.java:41)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

    at org.apache.catalina.valves.StuckThreadDetectionValve.invoke(StuckThreadDetectionValve.java:193)

    at org.apache.catalina.valves.CrawlerSessionManagerValve.invoke(CrawlerSessionManagerValve.java:180)

    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)

    at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:314)

    at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:305)

    at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:83)

    at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:305)

    at org.apache.catalina.valves.RemoteHostValve.invoke(RemoteHostValve.java:83)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)

    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

    at java.lang.Thread.run(Thread.java:722)

    If we delete the relationship and publish it to all tenants, we are able to install the app. We are not able to install the app with the relationship in it.

  • Created another issue: PSC00328765

  • Hi bakar,

    About issue PSC00328765 - Error installing app with OE-native relationship, can you provide a replication steps on this, our dev team seems to be cannot replicate the issue, I have tried replicating it but could not get the same error:

    1. In tenant with existing app, add a new OE object via OpenEdge Services

    2. Create relationship from OE to USER object as 1:1

    3. Publish app

    4. In a new tenant try to install the Published app via app directory

      * Let me know if I missed some steps

    Thanks,

    Orchid

  • Hi,

    We can reproduced the issue in 3.1.3.0 but we don't seem to see the issue in 3.2.1.0, we suspect it was indirectly fixed in the newer version.

    Please upgrade to newer version.

    Regards,

    Orchid