Not Showing integer values in crystal report formula field - vb.net

I am Working In VB.Net net Crystal Report, In that I need to sum a column values (integer)and display in the formula field . the problem is when the sum exceeds 10000 it shows like #### ,I Tried Format option in property but its not working , please somebody help me ...

It is not the problem with formatting.
Increase the size of the filed which you are using to display the value, then it will show the value.

Simply other option is you can set true "Can Grow" property of object. This will automatically expand if minimum width is exceed.
http://www.allaboutreports.com/index.php/tag/can-grow/
http://docs.imis.com/15.2/index.htm#!tipsandtrickscrystalreports.htm

Related

Adjusting number format using vb.net

I have this statement nested in an IF-Statement under a scenario. I would like it to format column 2 into a Accounting number without decimal places. How can this be done using VB.net? The current code gives me ex: 1,000,000.00 on an input of 1000000. I noticed excel has buttons for adding or subtracting decimal places. Could these be called within VB.net? Thanks!
Lo.ListColumns("Column2").DataBodyRange(CurrentRow).NumberFormat = "ACCOUNTING"
Try the following
Lo.ListColumns("Column2").DataBodyRange(CurrentRow).NumberFormat = "#0,000.00"
You may find help in this Article
From what i understand you want, you can do:
math.floor(*insert the value or variable you want here*)
What that does is it changes the number in the parameter to the biggest integer lower than the parameter.
Hope this works :)

How to sum the running total field value and formula field value in crystal report?

I want to add the running total field value and formula field value("Openbalnce"), the sum should be assigned to another formula field("Total").
In the formula editor of formula field("Total"),I have given as:
{runningtotalvalue} + {formula field value("Openbalnce")}
The Formula field ("Openbalnce")value is assigned in code behind and running total field value is directly assigned.
It shows the error
"A number,date or time,date etc is required here".
Please help me out of this.
This Is Working
({runningtotalvalue}) + CDBL({#"Openbalnce"})

SSRS rounds to whole numbers, but includes 2 decimal places

I have some SQL, of which the part in question is:
sum(Minutes)/60.0 Hrs
In SQL Server Management Studio, my database returns:
14.500000
In SSRS, my report displays:
14.00
My RDL's cell that displays this value has this definition:
=Fields!Hrs.Value
The cell's textbox properties have been defined as a Number, no checkboxes selected, 2 decimal points.
So, the question is, why is my report only outputting 14.00 rather than 14.50 and how can I fix it?
Edit: It may be worth mentioning that the cell data is strangely left-justified, despite not having told it to justify.
Try changing its definition to this:
=Format(CDbl(Fields!myFields.Value),"00.00")
I think you are using CInt instead of CDbl which will always try to return an integer. Hence the .00 at the end of your expression. Try:
=Format(CDbl(Fields!myFields.Value),"F2")
If you edit the textbox properties of the cell, and after selecting the type number, you change decimals two zero it should work regardless of the content of the cell.
Like this:

How to generate report

I have problem in generate report. I use crystal report 8.5 with vb.net 2008,what I want is when I generate report it will appear red value, if the value is more or less than actual value else it will give default value but when I put this code it give me wrong result
If {Intake.wheatType} = {Spec.WheatType} AND
{Intake.HB43} >={Spec.M_Min} AND{Intake.HB43} >={Spec.M_Max} Then
Red
Else
DefaultAttribute
this report is related with two tables, which is table Spec and table Intake. Could anyone help/teach me how to fix this problem
When determining whether a value is between a minimum and maximum, the logic will be:
Is the value greater than the minimum and is the value less than the maximum?
Actually you can create a Formula Field for that,
From Field Explorer, right click Formula Field
A popup window will appear, type the name of the formula you want.
in the Formula Editor insert you custome formula
Code:
If {Intake.wheatType} = {Spec.WheatType} AND {Intake.HB43} >={Spec.M_Min} AND {Intake.HB43} >={Spec.M_Max} Then
Red
Else
DefaultAttribute
Then click OK. Drag the newly created field on your report. And that's it.
For more info, see this: Adding Formula Field

Custom Number Format in Crystal Report !

How can i format quantity value in crystal report like if the value is 5, then just show as 5. If the value is 5.25, then show as 5.25. So which format should i use for that?
Thanks.
Right-click on the element and go into the formatting menu. I think what you want will be an option.
Instead of displaying it as a numeric value, write a function, MyStr$, which converts to string depending on whether the number is integer or not. BTW, a good way to check for integrality is a test of the form:
ABS(x -Truncate(x)) < EPS
where EPS is a small value, like 0.001 (depending on the accuracy you need, increase or decrease this)
Use this "conditional format formula":
If Truncate(CurrentFieldValue) = CurrentFieldValue
Then
0
Else
Length(ToText(ToNumber(StrReverse(ToText(Abs(CurrentFieldValue) - Truncate(Abs(CurrentFieldValue)),8,"",""))) / 10,0,""))
Go to the numeric report field, rightclick, choose "Format Field", choose "Number" tab, click "Customize" button. Put the formula above in the format formula ("X+2" button) for the format options "Decimals" and "Rounding".
BTW: In the formula you'll notice the number 8. This is the maximum expected number of decimals; if you think you'll encounter more decimals in your report then simply change 8 to a higher number.