Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Error in Formula Post Reply Post New Topic
Author Message
Lord Yorkshire
Newbie
Newbie
Avatar

Joined: 04 Jul 2010
Online Status: Offline
Posts: 28
Quote Lord Yorkshire Replybullet Topic: Error in Formula
    Posted: 07 Mar 2023 at 6:20am
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
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 08 Mar 2023 at 12:00am
Use this code (Crystal syntax):

If IsNumeric(Trim((split({SfReport.Ta18}, ":")[2]))) Then
    ToNumber(split({SfReport.Ta18}, ":")[2])
Else
    1
IP IP Logged
Lord Yorkshire
Newbie
Newbie
Avatar

Joined: 04 Jul 2010
Online Status: Offline
Posts: 28
Quote Lord Yorkshire Replybullet Posted: 08 Mar 2023 at 1:27am
Thank you, that worked and now the report gives me the information exactly as i wanted.

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.