91 lines
3.7 KiB
YAML
91 lines
3.7 KiB
YAML
info:
|
|
name: Elenco partecipanti per tabella HTML
|
|
type: http
|
|
seq: 3
|
|
|
|
http:
|
|
method: POST
|
|
url: "{{elixFormsApiUrl}}/eftl/process/v1"
|
|
headers:
|
|
- name: x-requested-with
|
|
value: XMLHttpRequest
|
|
- name: x-api-key
|
|
value: "{{elixFormsWsAuthenticationToken}}"
|
|
- name: x-ef-request-id
|
|
value: "19758"
|
|
disabled: true
|
|
- name: x-ef-request-id
|
|
value: "23629"
|
|
body:
|
|
type: json
|
|
data: "{\r
|
|
|
|
\ \"userDocument\": \"{{elixBase64EftlDocument}}\", // see the pre-request script\r
|
|
|
|
\ \"userContext\": {\r
|
|
|
|
\ \"lang\": \"IT\",\r
|
|
|
|
\ \"crlf\": \"\\r\\n\"\r
|
|
|
|
\ }\r
|
|
|
|
}"
|
|
auth: inherit
|
|
|
|
runtime:
|
|
scripts:
|
|
- type: before-request
|
|
code: |-
|
|
// Copy-pasta your EFTL document below inside the template literals (`)
|
|
var eftlDocumentToBeProcessed = String.raw`
|
|
[EFTL]
|
|
[HEADER name="trimDocument" value="true" type="boolean" /]
|
|
[VAR name="ripartizioniNominativiWithSep" type="string"][TAG]SCHEMAID,538,COL0005,ID_OBJECT,,#[/TAG][/VAR]
|
|
[VAR name="ripartizioniImportiWithSep" type="string"][TAG]SCHEMAID,538,COL0002,ID_OBJECT,,#[/TAG][/VAR]
|
|
|
|
[%= "<table><tr><th>Partecipante</th><th>Importo (EUR)</th></tr>" %]
|
|
|
|
[IF][CONDITION][IS_NOT_EMPTY varname="ripartizioniNominativiWithSep" /][/CONDITION][THEN]
|
|
[VAR name="ripartizioniNominativiIterable" type="iterable"][SPLIT regex="#"][VALUE_OF varname="ripartizioniNominativiWithSep" /][/SPLIT][/VAR]
|
|
[VAR name="ripartizioniImportiIterable" type="iterable"][SPLIT regex="#"][VALUE_OF varname="ripartizioniImportiWithSep" /][/SPLIT][/VAR]
|
|
[VAR name="ripartizioniCount" type="number"][SIZE_OF varname="ripartizioniNominativiIterable" /][/VAR]
|
|
[VAR name="ripartizioneIdx" type="string"][% ripartizioneIdx = 0; %][/VAR]
|
|
[VAR name="firstItem" type="number"][% firstItem = 0; %][/VAR]
|
|
[VAR name="secondItem" type="number"][% secondItem = 1; %][/VAR]
|
|
|
|
[WHILE threshold="99"]
|
|
[CONDITION][% ripartizioneIdx < ripartizioniCount %][/CONDITION]
|
|
[DO]
|
|
[VAR name="ripartizioneNominativoFull" type="string"][VALUE_OF varname="ripartizioniNominativiIterable" index="ripartizioneIdx" /][/VAR]
|
|
[VAR name="ripartizioneImporto" type="number"][VALUE_OF varname="ripartizioniImportiIterable" index="ripartizioneIdx" /][/VAR]
|
|
[VAR name="ripartizioneNominativoIterable" type="iterable"][SPLIT regex="] "][TRIM][VALUE_OF varname="ripartizioneNominativoFull" /][/TRIM][/SPLIT][/VAR]
|
|
|
|
[!-- Recupera il nominativo --]
|
|
[VAR name="ripartizioneNominativo" type="string"][VALUE_OF varname="ripartizioneNominativoIterable" index="secondItem" /][/VAR]
|
|
|
|
[% ripartizioneIdx = ripartizioneIdx + 1; %]
|
|
|
|
[!-- HACK ignobile per recuperare il numero che altrimenti verrebbe emesso come "1.0", etc... --]
|
|
[VAR name="ripartizioneKeyIterable" type="iterable"][SPLIT regex="\."][% ripartizioneIdx + "" %][/SPLIT][/VAR]
|
|
[VAR name="ripartizioneKey" type="string"][VALUE_OF varname="ripartizioneKeyIterable" index="firstItem" /][/VAR]
|
|
|
|
[%= "<tr><td>" + ripartizioneNominativo + "</td><td>" %][FORMAT type="number" pattern="#,##0.00"][% ripartizioneImporto %][/FORMAT][%= "</td></tr>" %]
|
|
[/DO]
|
|
[/WHILE]
|
|
[/THEN][/IF]
|
|
|
|
[%= "</table>" %]
|
|
[/EFTL]
|
|
`;
|
|
|
|
var base64EncodedDocument = btoa(eftlDocumentToBeProcessed);
|
|
|
|
bru.setVar("elixBase64EftlDocument", base64EncodedDocument);
|
|
|
|
settings:
|
|
encodeUrl: true
|
|
timeout: 0
|
|
followRedirects: true
|
|
maxRedirects: 5
|