Skip to main content
Solved

BPA Workflow - Integer cannot be cast to BigDecimal

  • October 11, 2024
  • 3 replies
  • 140 views

Marcel.Ausan
Ultimate Hero (Partner)
Forum|alt.badge.img+22

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 

Best answer by kamnlk

@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 

View original
Did this topic help you find an answer to your question?

3 replies

Marcel.Ausan
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Author
  • Ultimate Hero (Partner)
  • 1268 replies
  • October 14, 2024

Forum|alt.badge.img+9
  • Hero (Employee)
  • 132 replies
  • Answer
  • October 14, 2024

@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 


Marcel.Ausan
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Author
  • Ultimate Hero (Partner)
  • 1268 replies
  • October 14, 2024

@kamnlk this worked like a charm. Many thanks!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings