The loop block in the BPA diagram declare variable as global instead of keeping its value to the loop occurence.
I have 4 occurencesthat go in the loop bloc, all are having the same value when exiting the bloc
Any idea how to limite the scope of my variable to the current loop isntance?
var webServiceReponseStr;
var currencyFound = false;
var fetchedRate;
webServiceReponseStr= String(WebServiceResponse);
var index= webServiceReponseStr.search(newCurrencyCode);
if (index > 0){
currencyFound = true;
if (newCurrencyCode = 'CHF') { fetchedRate = WebServiceResponseR0].obs_value};
if (newCurrencyCode = 'GBP') { fetchedRate = WebServiceResponsec1].obs_value};
if (newCurrencyCode = 'CAD') { fetchedRate = WebServiceResponsev2].obs_value};
if (newCurrencyCode = 'USD') { fetchedRate = WebServiceResponsee3].obs_value};
}
else {
currencyFound = false;
fetchedRate = null;
}
execution.setVariable('newCurrencyRate',fetchedRate); -- this value is set to all 4 instances and not per loop instance
execution.setVariable('CurrencyRateAvailable', currencyFound);