We used the installer from: Controlled and timed data exchange across many platforms | Invantive Data Hub
After your message we took it from this page:
Invantive Data Hub
After unzip you get folder ‘smoke’ and inside a ‘tmp’ folder I found a .exe ‘Invantive Data Hub-win-x64-net8.0-25.0.127’ but not sure if this is correct. We think we need the Data Hub since this week a weekly query to get like 60 records/invoices plus invoice lines is not working anymore. It worked in less than a minute and now we get a time out. If you have a solution for the query also good.
This is the query that fails. We are pretty sure it has something to do with the joins but it worked for weeks until yesterday:
BEGIN
– Return output as CSV.
cloud_http.set_response_content_type(‘text/csv’);
cloud_http.set_response_header_value(‘Content-Disposition’, ‘attachment; filename=“invoices.csv”’);
– Append JSON form of table contents to HTTP output.
FOR r IN
(
SELECT
first(invoices.InvoiceID) as InvoiceID,
first(invoices.InvoiceNumber) as InvoiceNumber,
first(invoices.OrderNumber) as OrderNumber,
first(invoices.YourRef) as CreditReference,
first(case when invoices.type = 8024 then 381 when invoices.type = 8021 then 381 else 380 end) as type,
first(invoices.InvoiceDate) as InvoiceDate,
first(invoices.OrderDate) as OrderDate,
first(DATEADD(‘day’, ‘3’, invoices.InvoiceDate)) as DeliveryDate,
9 as MessageFunction,
‘EUR’ as CurrencyCode,
‘BY’ as PARTY_BY_QUALIFIER,
‘GLN’ as PARTY_BY_IDENTIFIERTYPE,
first(by.GlnNumber) as PARTY_BY_IDENTIFIER,
first(by.VATNumber) as PARTY_BY_VATID,
‘Vat_number’ as PARTY_BY_VATIDTYPE,
first(by.Name) as PARTY_BY_TRADINGNAME,
first(concat(by.AddressLine1, ’ ', by.AddressLine2, ’ ', by.AddressLine3)) as PARTY_BY_ADDRESS,
first(by.City) as PARTY_BY_CITY,
first(by.Postcode) as PARTY_BY_POSTCODE,
first(by.Country) as PARTY_BY_COUNTRYCODE,
‘IV’ as PARTY_IV_QUALIFIER,
‘GLN’ as PARTY_IV_IDENTIFIERTYPE,
first(iv.GlnNumber) as PARTY_IV_IDENTIFIER,
first(iv.VATNumber) as PARTY_IV_VATID,
‘Vat_number’ as PARTY_IV_VATIDTYPE,
first(iv.Name) as PARTY_IV_TRADINGNAME,
first(trim(concat(iv.AddressLine1, ’ ‘, iv.AddressLine2, ’ ‘, iv.AddressLine3))) as PARTY_IV_ADDRESS,
first(iv.City) as PARTY_IV_CITY,
first(iv.Postcode) as PARTY_IV_POSTCODE,
first(iv.Country) as PARTY_IV_COUNTRYCODE,
first(case when invoices.type = 8024 then invoices.InvoiceNumber else invoices.OrderNumber end) as SUPPORTING_DOCS,
first(abs(invoices.AmountFC)) as TOTALS_TOTAL_AMOUNT,
first(abs(invoices.AmountFCExclVat)) as TOTALS_NET_AMOUNT,
first(abs(invoices.VATAmountFC)) as TOTALS_TAX_AMOUNT,
listagg(
concat(
lines.LineNumber,’|’, /* 0 /
items.Barcode,‘|’, / 1 /
abs(lines.Quantity),‘|’, / 2 /
quote_literal(lines.NetPrice),‘|’, / 3 /
quote_literal(abs(lines.AmountFC)),‘|’, / 4 /
quote_literal(lines.NetPrice),‘|’, / 5 /
quote_literal(abs(lines.VATAmountFC)),‘|’, / 6 /
quote_literal(abs(lines.VATPercentage)),‘|’, / 7 /
lines.ItemCode,‘|’, / 8 /
csvencode(lines.ItemDescription) / 9 */
),
‘\n’
) as lines
FROM ExactOnlineREST.SalesInvoice.SalesInvoices invoices
JOIN ExactOnlineREST.CRM.Accounts iv on invoices.InvoiceTo = iv.ID
JOIN ExactOnlineREST.CRM.Accounts by on invoices.DeliverTo = by.ID
JOIN ExactOnlineREST.SalesInvoice.SalesInvoiceLines lines ON lines.InvoiceID = invoices.InvoiceID
JOIN ExactOnlineREST.Logistics.Items items ON lines.Item = items.ID
WHERE invoices.InvoiceTo in (
‘33333333-333333-333333-33333-333’,
‘222222-2222222-2222222-222222222’,
‘11111-1111-1111-111111-111111111’
) and invoices.Status = 50 AND invoices.InvoiceDate > trunc(sysdate) -14 AND invoices.AmountFC > 0.00 group by invoices.InvoiceID
FOR CSV
, column delimiter ‘,’
)
LOOP
cloud_http.append_to_response_body_text(r.csv);
END LOOP;
END;