0
votes

i want to display some records in a crystal report. for that i need to calculate sum fields . i need to calculate the sum of a field in sql table and i need to use where clause on that. in fomula section of the crystal report i write

{open}+{{#RTotal1}- {#RTotal0}}  

which gives error. the open is a textobject. where i go wrong in this.

the value of open Itextobject is passed from a textbox of the vb form by using this

DirectCast(GL2.Section2.ReportObjects("open"), CrystalDecisions.CrystalReports.Engine.TextObject).Text = TextBox8.Text

i think the problem is formula between textobject and fieldobject . where i go wrong nd what should i do.

1

1 Answers

0
votes

I assume {open} is being used as a text field rather than a numeric. Crystal reports has a function called ToNumber that converts numeric text into a number.

You would need to change your formula to:

ToNumber({open})+{{#RTotal1}- {#RTotal0}} 

As with everything on crystal; its best to play it safe to prevent errors; I would use:

if NumericText({open}) and not isnull({open}) then
   ToNumber({open})+{#RTotal1}- {#RTotal0} // text is numeric - use it.
else
   ({#RTotal1}- {#RTotal0}) // test is not a number, ignore it.