🖍️
Dataloy VMS API Documentation
(Old) Dataloy VMS API Documentation
(Old) Dataloy VMS API Documentation
  • Dataloy VMS API
  • Dataloy Rest API
    • What is it?
    • Authentication / Authorization
    • Getting Started
    • Data Model
    • Filtering
    • Sorting
    • Pagination
    • Adjust Number of Fields to be Returned from a Request
    • Webhooks
      • Webhook example
      • Expressions Made Easy
      • Webhooks - New functionalities
    • Master data Objects
    • Attachments
    • Audit Log
  • User Guides
    • Accounting Integration API
      • Invoicing
      • Payments/Receipts
      • Voyages
      • Business Partners
      • Exchange Rates
      • Bunker Transactions
      • Actuals
      • Autopost Invoices
      • Accruals
    • Schedule API
    • Bunker Order Integration API
    • Service Order Integration API
    • Vessel Report
      • Release 8.0
      • Release 7.3 - 7.12
      • Release 7.0 - 7.2
      • Release 6.29 - 6.46
      • Legacy version (6.26 - 6.28)
      • Vessel report master data
    • Bunker Consumption API
    • Left join in API queries
    • Enterprise functionalities
      • Versioning
      • Endpoint access control
      • Data access control via target object
      • Data access control via target object and security role
      • Data access control at object level
      • Fields access control
      • Alert Scripts
      • Websockets
      • Bulk Deletion
      • Copy objects
      • OR and AND operators in API queries
      • Sub queries
      • XML Transformation
      • Expressions
      • Bulk Update
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. User Guides

Left join in API queries

PreviousBunker Consumption APINextEnterprise functionalities

Last updated 1 year ago

Was this helpful?

The default behavior when an API query is executed is to put in right join the relationship between objects. From DLP 4.0.0 is possible specify in the filters of the API URL query to use left join instead of the right join.

For instance the following API query:

generates the following SQL query:

SELECT t0.CARGO_ID AS c0
FROM TBL_CARGO t0 JOIN TBL_VOYAGE t1 ON (t0.VOYAGE_ID = t1.VOYAGE_ID) JOIN TBL_VOYAGE_HEADER t2 ON (t1.VOYAGE_ID = t2.VOYAGE_ID)
WHERE ((t2.IS_BUDGET = 0) OR (t0.VOYAGE_ID IS NULL))

That will not return cargoes with voyages null.

Instead if the following query is executed:

encoded (+ become %2B):

generates the following SQL query:

SELECT t0.CARGO_ID AS c0
FROM TBL_CARGO t0 LEFT JOIN TBL_VOYAGE t1 ON (t0.VOYAGE_ID = t1.VOYAGE_ID) LEFT JOIN TBL_VOYAGE_HEADER t2 ON (t1.VOYAGE_ID = t2.VOYAGE_ID)
WHERE ((t2.IS_BUDGET = 0) OR (t0.VOYAGE_ID IS NULL))

It will return also cargoes with voyage null.

The same concept is used with sort:

Executing this query:

the following SQL query is executed:


SELECT  t0.CARGO_ID  FROM TBL_CARGO t0
     JOIN TBL_VOYAGE t2
    ON (t0.VOYAGE_ID = t2.VOYAGE_ID)
     JOIN TBL_VOYAGE_HEADER t3
    ON (t2.VOYAGE_ID = t3.VOYAGE_ID)
    ORDER BY t3.REFERENCE_NO

Instead running the following query:

the following SQL query is executed:

SELECT  t0.CARGO_ID  FROM TBL_CARGO t0
     LEFT JOIN TBL_VOYAGE t2
    ON (t0.VOYAGE_ID = t2.VOYAGE_ID)
     LEFT JOIN TBL_VOYAGE_HEADER t3
    ON (t2.VOYAGE_ID = t3.VOYAGE_ID)
    ORDER BY t3.REFERENCE_NO

http://platform-dev.dataloy.com/ws/rest/Cargo?pageNumber=1&limit=50&filter=voyage.voyageHeader.isBudget(EQ)0&filter=(OR)&filter=voyage(NULL)
http://platform-dev.dataloy.com/ws/rest/Cargo?pageNumber=1&limit=50&filter=voyage+.voyageHeader+.isBudget(EQ)0&filter=(OR)&filter=voyage(NULL)
http://platform-dev.dataloy.com/ws/rest/Cargo?pageNumber=1&limit=50&filter=voyage%2B.voyageHeader%2B.isBudget(EQ)0&filter=(OR)&filter=voyage(NULL)
http://platform-dev.dataloy.com/ws/rest/Cargo?sort=voyage.voyageHeader.referenceNo(AS)
http://platform-dev.dataloy.com/ws/rest/Cargo?sort=voyage%2B.voyageHeader%2B.referenceNo(AS)