Search code examples
c#crystal-reports

sap crystal report and if statment for different value


I am using if else crystal report statment for testing different values and make result value for returning it but there is always some error. This is the code that I made:

stringvar resultvalue := "";
NumberVar countervalue := 2;

if {Table1.ENTEDABBADAL} = 0
then
(
    resultvalue := resultvalue + "" 
)
else 
(
    countervalue := countervalue + 1 ;
    resultvalue := resultvalue + "(" & i & ")يصرف له بدل انتداب لمدة يومين بناءً على المادة 22/18 من نظام الخدمة المدنية" + ChrW(13)
)

if {Table1.TARH7EELBADAL} = 0
then
(
    resultvalue := resultvalue + "" 
)
else
(
    countervalue := countervalue + 1;  
    resultvalue := resultvalue + "(" & i & ") يصرف له بدل ترحيل راتب شهرين بناءً على المادة 27/5 من نظام الخدمة المدنية" + ChrW(13) 
)

if ({Table1.TABLEEKH} = 0)
then
(
    resultvalue := resultvalue + ""
)
else 
(
    countervalue := countervalue + 1 ;
    resultvalue := resultvalue + "(" & i & ")يبلغ هذا القرار مع الاساس لإدارة شؤون الموظفين ومن يلزمه لاعتماده";
)

return resultvalue;

But it gives me an error. How can I solve this problem? Inside the if condition different value testing and inside if make result value for displaying it in crystal report.


Solution

  • Formula in Crystal Reports must return a value. Crystal Reports assumes return is the name of the variable. Remove return in return resultvalue;.