info: name: Elenco partecipanti per dropdown con chiave 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: "21223" 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 (`)\r var eftlDocumentToBeProcessed = String.raw`\r [EFTL][HEADER name=\"trimDocument\" value=\"true\" type=\"boolean\" /]\r [VAR name=\"newLine\" type=\"string\"][VALUE_OF varname=\"crlf\" /][/VAR]\r \r [VAR name=\"responsabili\" type=\"string\"][TRIM][TAG]GETVALUEBYTAG,CONTRATTO_RESPONSABILI,REQUEST,IUQOID[/TAG][/TRIM][/VAR]\r [VAR name=\"partecipanti\" type=\"string\"][TRIM][TAG]GETVALUEBYTAG,CONTRATTO_PARTECIPANTI,REQUEST,IUQOID[/TAG][/TRIM][/VAR]\r \r [!-- Aggiungi primo elemento \"nullo\" --]\r [VAR name=\"ripartizioniElenco\" type=\"string\"][% ripartizioniElenco = \"[0] ---\" + newLine; %][/VAR]\r \r [VAR name=\"responsabiliIterable\" type=\"iterable\"][SPLIT regex=\"\\n\"][VALUE_OF varname=\"responsabili\" /][/SPLIT][/VAR]\r [VAR name=\"partecipantiIterable\" type=\"iterable\"][SPLIT regex=\"\\n\"][VALUE_OF varname=\"partecipanti\" /][/SPLIT][/VAR]\r \r [VAR name=\"responsabiliCount\" type=\"number\"][SIZE_OF varname=\"responsabiliIterable\" /][/VAR]\r [VAR name=\"partecipantiCount\" type=\"number\"][SIZE_OF varname=\"partecipantiIterable\" /][/VAR]\r \r [VAR name=\"personaIdx\" type=\"string\"][% personaIdx = 0; %][/VAR]\r [VAR name=\"dropdownIdx\" type=\"string\"][% dropdownIdx = 0; %][/VAR]\r \r [VAR name=\"firstItem\" type=\"number\"][% firstItem = 0; %][/VAR]\r [VAR name=\"secondItem\" type=\"number\"][% secondItem = 1; %][/VAR]\r \r [WHILE threshold=\"99\"]\r \ [CONDITION][% personaIdx < responsabiliCount %][/CONDITION]\r \ [DO]\r \ [VAR name=\"responsabileFull\" type=\"string\"][VALUE_OF varname=\"responsabiliIterable\" index=\"personaIdx\" /][/VAR]\r \ [VAR name=\"responsabileIterable\" type=\"iterable\"][SPLIT regex=\", CF: \"][TRIM][VALUE_OF varname=\"responsabileFull\" /][/TRIM][/SPLIT][/VAR]\r \r \ [!-- Recupera il nominativo --]\r \ [VAR name=\"responsabileNominativo\" type=\"string\"][VALUE_OF varname=\"responsabileIterable\" index=\"firstItem\" /][/VAR]\r \r \ [!-- Recupera il codice fiscale --]\r \ [VAR name=\"responsabileResto\" type=\"string\"][VALUE_OF varname=\"responsabileIterable\" index=\"secondItem\" /][/VAR]\r \ [VAR name=\"responsabileRestoIterable\" type=\"iterable\"][SPLIT regex=\", Qualifica: \"][VALUE_OF varname=\"responsabileResto\" /][/SPLIT][/VAR]\r \ [VAR name=\"responsabileCodiceFiscale\" type=\"string\"][VALUE_OF varname=\"responsabileRestoIterable\" index=\"firstItem\" /][/VAR]\r \r \ [% personaIdx = personaIdx + 1; %]\r \ [% dropdownIdx = dropdownIdx + 1; %]\r \r \ [!-- HACK ignobile per recuperare il numero che altrimenti verrebbe emesso come \"1.0\", etc... --]\r \ [VAR name=\"responsabileKeyIterable\" type=\"iterable\"][SPLIT regex=\"\\.\"][% dropdownIdx + \"\" %][/SPLIT][/VAR]\r \ [VAR name=\"responsabileKey\" type=\"string\"][VALUE_OF varname=\"responsabileKeyIterable\" index=\"firstItem\" /][/VAR]\r \r \ [% ripartizioniElenco = ripartizioniElenco + \"[\" + responsabileKey + \"] \" + responsabileNominativo + \" (CF: \" + responsabileCodiceFiscale + \")\"; %]\r \r \ [IF]\r \ [CONDITION][% personaIdx < responsabiliCount %][/CONDITION]\r \ [THEN]\r \ [% ripartizioniElenco = ripartizioniElenco + newLine; %]\r \ [/THEN]\r \ [ELSE IF]\r \ [CONDITION][IS_NOT_EMPTY varname=\"partecipanti\" /][/CONDITION]\r \ [THEN]\r \ [% ripartizioniElenco = ripartizioniElenco + newLine; %]\r \ [/THEN]\r \ [/ELSE IF]\r \ [/IF]\r \ [/DO]\r [/WHILE]\r \r [IF][CONDITION][IS_NOT_EMPTY varname=\"partecipanti\" /][/CONDITION][THEN]\r \ [% personaIdx = 0; %]\r \ [WHILE threshold=\"99\"]\r \ [CONDITION][% personaIdx < partecipantiCount %][/CONDITION]\r \ [DO]\r \ [VAR name=\"partecipanteFull\" type=\"string\"][VALUE_OF varname=\"partecipantiIterable\" index=\"personaIdx\" /][/VAR]\r \ [VAR name=\"partecipanteIterable\" type=\"iterable\"][SPLIT regex=\", CF: \"][TRIM][VALUE_OF varname=\"partecipanteFull\" /][/TRIM][/SPLIT][/VAR]\r \r \ [!-- Recupera il nominativo --]\r \ [VAR name=\"partecipanteNominativo\" type=\"string\"][VALUE_OF varname=\"partecipanteIterable\" index=\"firstItem\" /][/VAR]\r \r \ [!-- Recupera il codice fiscale --]\r \ [VAR name=\"partecipanteResto\" type=\"string\"][VALUE_OF varname=\"partecipanteIterable\" index=\"secondItem\" /][/VAR]\r \ [VAR name=\"partecipanteRestoIterable\" type=\"iterable\"][SPLIT regex=\", Qualifica: \"][VALUE_OF varname=\"partecipanteResto\" /][/SPLIT][/VAR]\r \ [VAR name=\"partecipanteCodiceFiscale\" type=\"string\"][VALUE_OF varname=\"partecipanteRestoIterable\" index=\"firstItem\" /][/VAR]\r \r \ [% personaIdx = personaIdx + 1; %]\r \ [% dropdownIdx = dropdownIdx + 1; %]\r \r \ [!-- HACK ignobile per recuperare il numero che altrimenti verrebbe emesso come \"1.0\", etc... --]\r \ [VAR name=\"partecipanteKeyIterable\" type=\"iterable\"][SPLIT regex=\"\\.\"][% dropdownIdx + \"\" %][/SPLIT][/VAR]\r \ [VAR name=\"partecipanteKey\" type=\"string\"][VALUE_OF varname=\"partecipanteKeyIterable\" index=\"firstItem\" /][/VAR]\r \r \ [% ripartizioniElenco = ripartizioniElenco + \"[\" + partecipanteKey + \"] \" + partecipanteNominativo + \" (CF: \" + partecipanteCodiceFiscale + \")\"; %]\r \r \ [IF]\r \ [CONDITION][% personaIdx < partecipantiCount %][/CONDITION]\r \ [THEN]\r \ [% ripartizioniElenco = ripartizioniElenco + newLine; %]\r \ [/THEN]\r \ [/IF]\r \ [/DO]\r \ [/WHILE]\r [/THEN][/IF]\r \r [%= ripartizioniElenco %]\r [/EFTL]\r `;\r \r var base64EncodedDocument = btoa(eftlDocumentToBeProcessed);\r \r bru.setVar(\"elixBase64EftlDocument\", base64EncodedDocument);" settings: encodeUrl: true timeout: 0 followRedirects: true maxRedirects: 5