Originally posted by: SystemAdmin
I'am didn't find documentation or example on how to alter a integer dataElement with an Interface (API C# or Java).
I use the mulprod_main exemple to show my problem.
OPL Parameters:
int NbPeriods = ...;
float Capacity
Resources = ...;
OPL Script data element
var data = produce.dataElements;
In OPL script, I can alter a parameter value this way:
For array or int:
data.Capacity = capFlour;
For int:
data.NbPeriods=3;
With the API.
For array of float I can do it this way:
dataElements.GetElement("Capacity").AsNumMap().Set("flour", capFlour);
For integer, I can't figure how to do the same operation. My problem is that this didn't work:
dataElements.GetElement("NbPeriods").AsInt().Set(2);
The solution is probably obvious but I didn't find anything about that in the documentation or in the examples.
Thank you in advance,
MB
#DecisionOptimization#OPLusingCPLEXOptimizer