Hi Jose,
Please comment the follow lines in the RebuildComplexValue function in ServiceLayerService.cs
There are some special logic to handle 0 value here before sending the request to Service Layer.
The current logic is ignore the property having value as zero. Simply, zero is quite special in B1, some times it is just like a null value by default for some property.
In your case, we shouldn't use this piece of logic for we intend to set the BaseLine as 0.
for example.
BaseLine = 0;
privateODataComplexValueRebuildComplexValue(ODataComplexValuesource)
{
ODataComplexValuenewVal = newODataComplexValue();
newVal.TypeName = source.TypeName;
List<ODataProperty> complexSons = source.Properties.ToList();
//Filter to get new list
List<ODataProperty> filteredSons = newList<ODataProperty>();
foreach (ODataPropertypropincomplexSons)
{
PropertyTyperetType = GetPropertyType(prop);
switch (retType)
{
casePropertyType.SimpleEdmx:
{
if (null != prop.Value)
{
if (prop.Value.GetType().Name == "Int32")
{
//Check the value now.
boolbInclude = false;
try
{
//TODO: You cannot simply do this, potential bugs there maybe.
//Use your own logics the determine if need to ignore ZEORs or not.
intval = Convert.ToInt32(prop.Value);
bInclude = (0 != val);
}
catch (Exception)
{
}
if (bInclude)
filteredSons.Add(prop);
}
else
filteredSons.Add(prop);
}
}
break;
casePropertyType.ComplexType:
{
//Recursively
ODataComplexValuecomx = RebuildComplexValue((ODataComplexValue)prop.Value);
if (comx.Properties.Count() > 0)
{
prop.Value = comx;
filteredSons.Add(prop);
}
}
break;
casePropertyType.Collection:
{
ODataCollectionValuecoll = RebuildCollectionValue((ODataCollectionValue)prop.Value);
List<ODataComplexValue> listSubs = (List<ODataComplexValue>)coll.Items;
if (listSubs.Count> 0)
{
prop.Value = coll;
filteredSons.Add(prop);
}
}
break;
default:
break;
}
}
//Re-Assign sons
newVal.Properties = filteredSons;
returnnewVal;
}
Kind Regards, Yatsea