Visual Builder

Get Involved. Join the Conversation.

Topic

    Samuel Lima
    Can't Fetch a Business Object with a Subset of ItemsAnswered
    Topic posted October 4, 2019 by Samuel LimaBlue Ribbon: 750+ Points, tagged Business Objects, REST 
    28 Views, 8 Comments
    Title:
    Can't Fetch a Business Object with a Subset of Items
    Content:

    Hi, experts,

    I need to fetch an object data and all the objects data linked to it.

    I'm trying to fetch an object with a linked object as in the attached image.

    Used the fields parameter as in chapter 4 of the following tutorial:

    https://docs.oracle.com/en/cloud/paas/app-builder-cloud/consume-rest/accessing-business-objects-using-rest-apis.pdf

     

    But when I send this request with "fields=ano;FeriadoAno:dataFeriado":

    I set REST-Framework-Version to 6

    https://oic-nonononono.integration.ocp.oraclecloud.com:443/ic/builder/design/SL_Task_List/1.0/resources/data/FeriadoAno?fields=ano;FeriadoAno:dataFeriado

    Got this error:

    {
        "title": "Bad Request",
        "status": "400",
        "o:errorDetails": [
            {
                "detail": "URL request parameter fields with value ano;FeriadoAno:dataFeriado is not valid.",
                "o:errorCode": "27519"
            }
        ]
    }

    What am I doing wrong.

    Image:

    Best Comment

    David Konecny

    See attached app in which I tried to recreate your model and against which I can run

    https://oraic-cloud01.integration.ocp.oraclecloud.com/ic/builder/design/feriado/1.0/resources/data/FeriadoAno?fields=ano;feriadoCollection:dataFeriado&onlyData=true&q=feriadoCollection.dataFeriado>'2019-01-01'

    successfully. One thing which is incorrect in your screenshot is filtering by "dateFeriado" - that field is coming from Feriado BO and so it needs to be prefixed properly. Second problem is that you will not be able to sort by dataFeriado because you are querying FeriadoAno records and each FeriadoAno can have multiple feriadoCollection.dataFeriado dates and so it is not clear how FeriadoAno records should be sorted in such case. Why don't you query directly Feriado records??

    Does looking at my app and comparing it with yours clarifies where your problem was?

    Thanks,
    -David

    Comment

     

    • Shay Shmeltzer

      Does it work if you use the actual name of the accessor:

      https://oic-nonononono.integration.ocp.oraclecloud.com:443/ic/builder/design/SL_Task_List/1.0/resources/data/FeriadoAno?fields=ano;FeriadoAnoObject:dataFeriado

    • Samuel Lima

      Hi Shay,

      Tried it but the same error:

      https://oic-nononono.integration.ocp.oraclecloud.com:443/ic/builder/design/SL_Task_List/1.0/resources/data/FeriadoAno?fields=ano;feriadoAnoObject:dataFeriado

      {
          "title": "Bad Request",
          "status": "400",
          "o:errorDetails": [
              {
                  "detail": "URL request parameter fields with value ano;feriadoAnoObject:dataFeriado is not valid.",
                  "o:errorCode": "27519"
              }
          ]
      }

       

    • David Konecny

      When referring to other entity fields you need to use name specified in "Relationship Name" (in Edit Relationship dialog). The very first image you attached says (on the left) that "feriadoCollection" is the name which FeriadoAno entity query can use to refer to Feriado records. BUT(!) the "Enable Accessor" needs to be enabled too for this to work too. Enable it and try /data/FeriadoAno?fields=ano;feriadoCollection:dataFeriado

      -David 

    • Samuel Lima

      Hi David,

      I think I did exactly what you said.

      Enabled Accessor in the FeriadoAno and tried the parameter /data/FeriadoAno?fields=ano;feriadoCollection:dataFeriado.

      But no success.

      Images attached.

    • David Konecny

      See attached app in which I tried to recreate your model and against which I can run

      https://oraic-cloud01.integration.ocp.oraclecloud.com/ic/builder/design/feriado/1.0/resources/data/FeriadoAno?fields=ano;feriadoCollection:dataFeriado&onlyData=true&q=feriadoCollection.dataFeriado>'2019-01-01'

      successfully. One thing which is incorrect in your screenshot is filtering by "dateFeriado" - that field is coming from Feriado BO and so it needs to be prefixed properly. Second problem is that you will not be able to sort by dataFeriado because you are querying FeriadoAno records and each FeriadoAno can have multiple feriadoCollection.dataFeriado dates and so it is not clear how FeriadoAno records should be sorted in such case. Why don't you query directly Feriado records??

      Does looking at my app and comparing it with yours clarifies where your problem was?

      Thanks,
      -David

    • Samuel Lima

      Hi David,

      I did exactly what you said and it worked perfectly.

      Thank you so much !!!

      • David Konecny

        Btw. when you use VB Quick Start to for example add data to a table component, the quick start wizard allows you graphically select "dataFeriado" and referenced "ano" fields and enter filtering and sorting params. And VB composes above REST URL automatically for you. So no need to dive deep into REST call syntax details and PostMan.

        -David