Error in Formula

Printed From: Crystal Reports Book — Forum Name: Technical Questions

I have a report that runs most of the time, but if i have a blank field it errors.

I am trying to pull a number out of a string but if there is no number, i get a non numeric error message.

How do i introduce a bit that says if there is no number after the “:” just put 1

tonumber(right({SfReport.Ta18},(len({SfReport.Ta18})- (Instr({SfReport.Ta18}, ":") ))))

The data looks like this

Sheet Size : 1200
Or
Sheet Size :

1st one is fine, 2nd one is where i get the error.

Edited by Lord Yorkshire - 07 Mar 2023 at 7:00am
Use this code (Crystal syntax):

If IsNumeric(Trim((split({SfReport.Ta18}, ":")[2]))) Then
    ToNumber(split({SfReport.Ta18}, ":")[2])
Else
    1
Thank you, that worked and now the report gives me the information exactly as i wanted.