documentatie van Invantive
Invantive Support ForumsAanmelden / Inschrijven

Zip-aggregatiefunctie

Syntax

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    zipAggregateFunction_start((START))
    zipAggregateFunction_start --> zipAggregateFunction_0_0[ZIP]:::quoted
    zipAggregateFunction_0_0 --> zipAggregateFunction_0_1["("]:::quoted
    zipAggregateFunction_0_1 --> zipAggregateFunction_0_2[expressionList]
    zipAggregateFunction_0_2 --> zipAggregateFunction_0_3[")"]:::quoted
    zipAggregateFunction_0_3 --> zipAggregateFunction_end((END))

Doel

Groepsfunctie die de binaire documenten van een groep combineert tot één ZIP-archief. De eerste expressie levert de binaire inhoud (blob) van elk document; de tweede expressie levert de bestandsnaam van het document binnen het archief. Voorkomens van null-inhoud worden overgeslagen; wanneer uitsluitend null-inhoud aanwezig is, is het resultaat null.

Retourneert: het ZIP-archief als blob.

Voorbeelden

Het volgende voorbeeld combineert de factuur-PDF-documenten van alle klanten tot één ZIP-archief, bijvoorbeeld om aan een accountant over te dragen; het resultaat is één blob met een bestand per factuur:

select zip(ivc.pdf_document, ivc.invoice_number || '.pdf') invoices_archive
from   invoices ivc

Het volgende voorbeeld combineert de factuur-PDF-documenten per klant tot één ZIP-archief per klant, bijvoorbeeld om elke klant een kopie van de openstaande facturen te sturen, en noemt elk archief naar de klant:

select ivc.customer_name
,      zip(ivc.pdf_document, ivc.invoice_number || '.pdf') invoices_archive
from   invoices ivc
group
by     ivc.customer_name