Skip to main content

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

 

 

 

 

 

 

Can you share bit more about the loop you declared in the workflow?

its bit unclear on where the variable is declared.. If the variable is declared outside of the loop it will be shared and the same value would appear inside the loop instances. If the variable declaration is done inside the loop then the value should have an individual value per loop.


@kamnlk  i’m using the standard BPA provided by IFS 23.1.13 finCurrencyTypeUpdate

The declaratin is done inside the loop  using the setVariable (see redArrow) and using the result variable field  (see yellow block) 

 

 


Reply