- Create 50 transactions for pain.008.001.02.xsd - Converting Julian dates (0yyddd) to ISO - Converting ISO dates to Julian (0yyddd) - Save multiple outputs with different default namespace
Create 50 transactions for pain.008.001.02.xsd
auto i : 0;
foreach n in (PmtInf)
foreach a in (Set{1 .. 49})
auto newTx : copy(n.DrctDbtTxInf->asSequence()->at(0));
auto iban : String.buildIBAN("DE");
newTx.DbtrAcct.Id.IBAN : iban;
newTx.PmtId.EndToEndId : 'EndToEndId_' + i.toString();
i : i + 1;
n.DrctDbtTxInf.add(newTx);
endeach;
endeach;
GrpHdr.CtrlSum : PmtInf.DrctDbtTxInf.InstdAmt->sum();
GrpHdr.NbOfTxs : PmtInf.DrctDbtTxInf->size().toString();
Converting Julian dates (0yyddd) to ISO
auto var : date.today().toString();
auto year : ("20" + var.substring(1,2)).toInteger();
auto days : var.substring(3,4).toInteger();
auto daysInMonths : Sequence{31,28,31,30,31,30,31,31,30,31,30,31};
// Leap year?
if (year % 4 = 0) then
if (year % 100 = 0) then
if (year % 400 = 0) then
// LEAP
daysInMonths->at(1) : 29;
endif;
else
// LEAP
daysInMonths->at(1) : 29;
endif;
endif;
// Count the days
auto month : 1;
foreach d in (Set{1 .. 12})
if (days > daysInMonth->at(d))
days = days - daysInMonth->at(d);
month = month + 1;
endif;
endeach;
// Modify the month and day
if (month < 10)
month = "0" + month.toString();
else
month = month.toString();
endif
if (days < 10)
days = "0" + days.toString();
else
days = days.toString();
endif
// Result it in the right format
auto result : year + "-" + month + "-" + day;
Converting ISO dates to Julian (0yyddd)
auto var : date.today().toString();
auto year : var.substring(0,4).toInteger();
auto month : var.substring(5,7).toInteger();
auto day : var.substring(8,10);
auto daysInMonths : Sequence{31,28,31,30,31,30,31,31,30,31,30,31};
// Leap year?
if (year % 4 = 0) then
if (year % 100 = 0) then
if (year % 400 = 0) then
// LEAP
daysInMonths->at(1) : 29;
endif;
else
// LEAP
daysInMonths->at(1) : 29;
endif;
endif;
// Count the days
auto totalDays : 0;
foreach d in (Set{1 .. month})
totalDays : totalDays + daysInMonths->at(d - 1);
endeach;
totalDays : totalDays + day.toInteger();
// Modify the year
auto yearstr : "0" + year.toString().substring(2,4);
// Return it in the right format
auto result : yearstr.concat(totalDays.toString());
result : result.substring(0,6);
return result;
Save multiple outputs with different default namespace
// Save all
// pain.009
save(doc,"pain009_testfile_" + filenumber.toString());
// pain.010
setNamespacePrefix("","urn:iso:std:iso:20022:tech:xsd:pain.010.001.03");
save(doc010,"pain010_testfile_" + filenumber.toString());
// pain.011
setNamespacePrefix("","urn:iso:std:iso:20022:tech:xsd:pain.011.001.03");
save(doc011,"pain011_testfile_" + filenumber.toString());