invantive-dokumentationen del av Invantive Cloud
Invantive supportforumLogga in / Registrera dig

Zip-aggregatfunktion

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))

Syfte

Gruppfunktion som kombinerar de binära dokumenten i en grupp till ett ZIP-arkiv. Det första uttrycket anger det binära innehållet (blob) för varje dokument; det andra uttrycket anger filnamnet för dokumentet i arkivet. Förekomster av null-innehåll hoppas över; när endast null-innehåll finns, blir resultatet null.

Returnerar: ZIP-arkivet som blob.

Exempel

Följande exempel kombinerar fakturornas PDF-dokument för alla kunder till ett ZIP-arkiv, till exempel för att lämna över till en revisor; resultatet är en blob som innehåller en fil per faktura:

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

Följande exempel kombinerar fakturornas PDF-dokument per kund till ett ZIP-arkiv per kund, till exempel för att skicka varje kund en kopia av de öppna fakturorna, och namnger varje arkiv efter kunden:

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