Count no of entries from column

I have a field “abap_months” and I have calculated it as follows:

@If(@Count(@DbColumn( “Notes” : “NoCache” ; “” ; “abapview3” ;1 ) ) = 0 ; 0;

@Sum(@DbColumn( “Notes” : “NoCache” ; “” ; “abapview3” ;2 )))

The problem is that if the view contains any entry then it works fine but if the view is empty or contains no entry then it gives error:

/field “abap_months”:Incorrect data type for operator or at function: Number expected/

any tips?

Regards,

Aisha Ishrat.

Subject: count no of entries from column

You need to introduce error handling code before applying sum function. e.g.

newValue := @DbColumn( “Notes” : “NoCache” ; “” ; “abapview3” ;2 );

@sum(@If(@isError(newValue) | newValue = “”;0;NewValue));

Subject: RE: count no of entries from column

@DbColumn( “Notes” : “NoCache” ; “” ; “abapview3” ;2 ); must be returning a text value. As far as i know @sum can only be used with only with numbers.