cancel
Showing results for 
Search instead for 
Did you mean: 

How can i query from LineDocument from Master Document?

SayEangKheang
Explorer
0 Kudos
1,308

Hi, is there any way to filter or query from Line Document in API ServiceLayer?

example:

Thank you.

View Entire Topic
SayEangKheang
Explorer
0 Kudos

Thank for your reply,

I have check on what you give above but i have read it and i don't really understand on 3.7.10.1 Metadata for Query Service.

 /b1s/v1/QueryService_PostQuery
{
    "QueryPath": "$crossjoin(Orders,Orders/DocumentLines)",
    "QueryOption": "$expand=Orders($select=DocEntry, DocNum),Orders/DocumentLines($select=ItemCode,LineNum)&$filter=Orders/DocEntry eq Orders/DocumentLines/DocEntry and Orders/DocEntry ge 3 andOrders/DocumentLines/LineNum eq 0"
}

and I got error message from API.
{
    "error": {
        "code": 201,
        "message": {
            "lang": "en-us",
            "value": "Not supported query option"
        }
    }
}
mgregur
Active Contributor
0 Kudos

Hi,

which version are you using? Because I get a good response...

POST /b1s/v1/QueryService_PostQuery

BODY
{  "QueryPath": "$crossjoin(Orders,Orders/DocumentLines)",  "QueryOption": "$expand=Orders($select=DocEntry, DocNum),Orders/DocumentLines($select=ItemCode,LineNum)&$filter=Orders/DocEntry eq Orders/DocumentLines/DocEntry and Orders/DocEntry ge 3 and Orders/DocumentLines/LineNum eq 0" }

Response:

{
   "odata.metadata" : "$metadata#Collection(Edm.ComplexType)",
   "value" : [
      {
         "Orders" : {
            "DocEntry" : 177,
            "DocNum" : 75
         },
         "Orders/DocumentLines" : {
            "ItemCode" : "23",
            "LineNum" : 0
         }
      },
      {
         "Orders" : {
            "DocEntry" : 209,
            "DocNum" : 94
         },
ETC
   ],
   "odata.nextLink" : "QueryService_PostQuery?$expand=Orders($select=DocEntry, DocNum),Orders/DocumentLines($select=ItemCode,LineNum)&$filter=Orders/DocEntry eq Orders/DocumentLines/DocEntry and Orders/DocEntry ge 3 and Orders/DocumentLines/LineNum eq 0&$skip=20"
}

BR,

Paul_
Explorer
0 Kudos
Need space inbetween and and Orders/... "andOrders/DocumentLines/LineNum eq 0"