You need to sign in to do that
Don't have an account?

Lsit of decimal
List<Decimal> cal =new List<Decimal>();
public decimal fun(){
cal.add(0.0);
cal.add(0.1);
return cal; // This is possible, But when I have to return that time to display error: "Return value must be of type: Decimal at line"
}
If any one know how to return the list decimal value into function.
public decimal fun(){
cal.add(0.0);
cal.add(0.1);
return cal; // This is possible, But when I have to return that time to display error: "Return value must be of type: Decimal at line"
}
If any one know how to return the list decimal value into function.
Since your method returning just Decimal, NOT List<Decimal>. Based on you need you can alter the below suggested codes,
OR Change your method to return type from Decimal to List<Decimal>
You can try this: OR OR
Hope this will be resolve the issue.
Please mark it as the best answer if it helps.
Thanks
private Decimal scenario4(Id ssVar1Id){
if(mapServiceSheetIdVisitRecord.get(ssVar1Id).Priority__c == '4 Hour Corrective'){
if(!isOutOfMonFri830AMto5PM){
System.debug('####'+'Sce 4: Pri=4C,Dep Time : Inside Office Hours');
salePrice.add(insideOfficeHoursPri4CSce4(ssVar1Id)); // This call another mathod
}
return salePrice; // Here Error is Occured.
}
private Decimal insideOfficeHoursPri4CSce4(Id ssVar1id){
System.debug('####'+'Sce 4: Pri=4C,Dep Time : Inside Office Hours:BEGIN');
System.Debug('####List Of Split Hours is'+listOfSplitHoursSpent);
If(listOfSplitHoursSpent.size() > 1){
noOfHoursInOfficeTime=listOfSplitHoursSpent.get(0);
noOfHoursOutOfficeTime = listOfSplitHoursSpent.get(1);
noOfHoursInOfficeTimeAgain = listOfSplitHoursSpent.get(2);}
callOutCharge4HourResponse = (mapServiceSheetIdSiteContractRecord.get(ssVar1id)).X4_Hour_Reactive_Call_Out_Charge__c;
labourChargePerHour=(mapServiceSheetIdSiteContractRecord.get(ssVar1id)).Labour_Charge__c;
if(callOutCharge4HourResponse==null){
System.debug('####callOutCharge4HourResponse is Null, Hence Substituted by 0');
callOutCharge4HourResponse=0.0;
}
if(labourChargePerHour==null){
System.debug('####labourChargePerHour is Null, Hence Substituted by 0');
labourChargePerHour=0.0;
}
salePrice1 = callOutCharge4HourResponse +(labourChargePerHour*noOfHoursInOfficeTime);
Calloutcharge = callOutCharge4HourResponse;
Labourcharge = labourChargePerHour*noOfHoursInOfficeTime;
salePrice.add(salePrice1);
salePrice.add(Calloutcharge);
salePrice.add(Labourcharge);
System.debug('####'+'Sce 4: Pri=4C,Dep Time : Inside Office Hours:END');
System.debug('####'+'Sce 4: Pri=4C,Dep Time : Inside Office Hours:SALEPRICE'+salePrice);
return salePrice;
}
This is my code.