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
Related
I thought this would have been a simple task, I want to change the font colour of a field in a Crystal Report if it differs from another field value. Essentially I have two numeric fields and want to change the font to red if they are different.
I have used the Format Editor>Font>Color formula method. I have tried the following code/s ...
if ToNumber({Petty_Cash.PettyCashandMoneyIntroduced}) = ToNumber({Petty_Cash.LessTotalPaymentsByPettyCash}) Then crBlack Else CrRed;
if {Petty_Cash.PettyCashandMoneyIntroduced} <> {Petty_Cash.LessTotalPaymentsByPettyCash} Then crRed Else CrBlack;
Neither of these will work, if I add a numeric value it will work....
if {Petty_Cash.PettyCashandMoneyIntroduced} >=90 Then crBlack Else CrRed;
I'm hoping it's something simple that I have overlooked.
Any ideas please?
I am having trouble changing the title of some columns in a pivot table. I'm trying to make them have dates in them. Each date 6 days further from the last.
Like this
But, I cannot get an equation inside the column title to stay, every time I type in the equation and press enter, it evaluates to either 0 (If the format of the cell is number or general), or 1/0/1990 (If formatted as a date). I checked the value of the cell by =ISTEXT(A1) and it evaluates as true. No matter how I format the cell. So I can never change the title to look like the picture. Any ides?
Here is what I have.
TRUE is the result from ISTEXT()
Even if I manually enter in the formula via the function arguments, it'll show up correct, but when I click ok. It will go back to either 0 or 1/0/1990
Here's the original page
https://drive.google.com/file/d/0B3p8Jm7oNAo4ZUN0Qk1mR1cxYmM/view?usp=sharing
In Excel, dynamic values (formulas) in the header of a table-formatted table are not allowed.
Instead, you can first generate your table header and then format the table as (pivot-)table. You should get a message saying that the header row will be converted in static text (with correct format).
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
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"})
I create a pirvot table, but the colunm order is not what I wanted. I want to move one column to right end. I can do it in Excel, but don't know how to do it with VBA.
In Excel, can do in this way--active the column header which you want to move, click right-hand button, choose Move, Move "--" to end.
Record Macro--when record Macro, it just shows the exact position, just like,
ActiveSheet.PivotTables("PivotTable16").PivotFields("wk").PivotItems("#VALUE!") _
.Position = 12
But I want to use the Macro in other files, maybe the end position is not 12. Then the Macro can't be used.
Hope can get help here. How to do it to move the colunm to end by VBA? Thanks.
I hope I get you right.
You can get the end position by
ActiveSheet.PivotTables("PivotTable1").PivotFields("whatever").PivotItems.count
Basically it returns the number of items for a label
Edited
So you could do like
Dim total as Integer
total = ActiveSheet.PivotTables("PivotTable1").PivotFields("whatever").PivotItems.count
ActiveSheet.PivotTables("PivotTable1").PivotFields("whatever").PivotItems("whatever").position = total
Just a random note to anyone that comes across this and runs into the same issue I did. If in your macro you're hiding fields, it's going to give you an error. Don't use this code as the last thing you do when setting up your pivot table. Use this code, let it move to the bottom position, THEN have your code to hide your fields. If you hide fields first, it'll count the hidden fields then try to move it outside your pivot table and cause an error.