Print Page | Close Window

a string is required here.

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=17272
Printed Date: 06 May 2024 at 11:09am


Topic: a string is required here.
Posted By: swallow.pa
Subject: a string is required here.
Date Posted: 11 Aug 2012 at 4:03am
hi all
I Use This Codes in my Report


IF Right({rptProductAction2.Quanty},2)='00' THEN
Round({rptProductAction2.Quanty})

but i see an error( a string is required here.)
in this line:
Right({rptProductAction2.Quanty},2)

how solve it
please help me
thanks



Replies:
Posted By: Robotacha
Date Posted: 12 Aug 2012 at 8:29am
Not sure if trolling or not, but here goes,

I assume your .quanty field is a number ,as you are trying to round it.

Its because your product.quanty field is a number field/value. the RIGHT command is for text fields/values.

not sure though, why you want to round a number if it ends in 00. surely this is already rounded?


o_O



-------------
Regards,

Michael Jones


Posted By: swallow.pa
Date Posted: 13 Aug 2012 at 3:11am
thnks dear for your help
For Example:
I Have 2 values in this field...
my values Is:
95080.58
90830.00
now I want to see this
95080.58
90830

how to solve it
thanks


Posted By: hilfy
Date Posted: 13 Aug 2012 at 3:16am
You would have to convert both to strings to get that format - Crystal will always format numbers based on the number of decimals you set for the field - it's not variable.
 
So, you would have to do something like this:
 
If Right(ToText({rptProductAction2.Quanty}, 2) = '00' then
  ToText({rptProductAction2.Quanty}, 0, '')
else ToText({rptProductAction2.Quanty}, 2, '')
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: swallow.pa
Date Posted: 13 Aug 2012 at 4:26am
thanks dear for your help



Print Page | Close Window