Print Page | Close Window

Prewiew CR error

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=3641
Printed Date: 08 May 2024 at 3:02pm


Topic: Prewiew CR error
Posted By: nalfein
Subject: Prewiew CR error
Date Posted: 08 Jul 2008 at 11:43pm
Hi all i have a field in the report that have this formula:

numbervar start := instr({@articolo}, {@Form1}) + len({@Form1});
numbervar stop := instr({@articolo},{@Form3}) +2;

Mid ({@articolo}, start,stop - start - 2)

And all works good if records are a certain size (example: me.you.them.all)

If some record is short (example: me.you) the prewiev and following print cannot be done and CR report this problem

"String lenght is less than 0 or not an integer"

Can i put some formula to skip this problem so if start or stop are less than 0 (i think that is the problem) they come back positive?

I've tried with this formula:

numbervar start := instr({@myfield}, {@Form1}) + len({@Form1});
numbervar stop := instr({myfield},{@Form3}) +2;

if start <0 or stop <0 then

{@myfield}

else


Mid ({@myfield}, start,stop - start - 2)

But the messsage is the same

Any idea?

Thnx for help in advance



Replies:
Posted By: rahulwalawalkar
Date Posted: 09 Jul 2008 at 2:01am
Hi
 
Did you try <= 0
 
Can you post the data for  @articolo and @Form1,@Form3,@myfield
 
cheers
Rahul


Posted By: nalfein
Date Posted: 09 Jul 2008 at 5:03am
@articolo and @myfield are the same sorry

Data on those fields are on this format:
xxx.xxxxx.xxx.xx.xx
or similar lenght

@form1 is:
left({@myfield},instr({@myfield},'.')-1)

@form3 is:
Right({@myfield},instr({@myfield},'.')-2)

the problem is when the data on @myfield are similar to this kind of format:
x.xxx.xxx.xx
or
x.xxx.xx

So when they're short

I've tried with <=0 but the same error appear

Thnx in advance for help





Print Page | Close Window