Skip to main content

I’m trying to create a WF to calculate the InventoryTurnover KPI.

I’m executing a call to InventoryTurnoverRateHandling → GetCurrencyAndTurnoverRate. The call executes successfully if I hardcode the numeric params (from/to Period / Year)

 

However if I wanna use the variables that I set in the previous step → ${fromYear} | ${fromPeriod} | ${toYear} | ${toPeriod} I get an error that Int to BigDecimal cast is not possible:

 

When I look in API explorer I see the API call is expecting numbers. Which is what I already provide. Any ideas what I can do to execute the Projection call inside the workflow using variables and not hardcoded values?

 

@dsj 

@kamnlk @Lahirumala de Mel @dsj any ideas?


@Marcel.Ausan  

I tried the following to convert the value using a script task and was able to get it to work.

//option 1
//fromYear = 2024  //set from a previous task

var BigDecimal = Java.type('java.math.BigDecimal');
execution.setVariable("fromYear", BigDecimal.valueOf(fromYear));

 

//option 2: make the hardcoded value as a decimal 
execution.setVariable("toYear", 2024.0);

 

can you give it a try and see 


@kamnlk this worked like a charm. Many thanks!


Reply