I have searched on other questions similar to this but none seem to be in the same situation.
I have a series of transactions in which I am using a running total named TranNumber which resets on the change of the account number. When I sort by descending transaction date this running total gives me the most recent transaction as 1.
I also have another formula which contains a list of transaction codes and their position on a workflow (done using a select case formula).
I have tried to sum the following formula as well as variations such as using variables and passing data into a sub report and back to 'trick' the software into not seeing it as a running total, still to no avail as I can then not sum a variable.
if {#TranNumber} = 1 then
if {#ProcCode} startswith "1 - " then 1 else 0
Ultimately I want a count of accounts in each position on the workflow to then put into a graphical form.
If anyone has tried to do this successfully or can suggest a way to only bring back the most recent transactions for each account to avoid having to use the above method it would be greatly appreciated :)
Thanks in Advance
Resolved this issue by using the formula above and assigning to a variable and placing a counter formula in the details which worked like the below
shared numbervar x;
If {#TranNumber} = 1 then
if {#ProcCode} startswith "1 - " then x := x + 1
I then placed this formula in the details and then simply output the variable in the report footer which gave me the number I was looking for.
Related
I am creating a invoice printing system using Crystal Reports XI, where I get item details and quantity from database but item rate is entering by the end use as a comma separated parameter field. I am able to show rate with their corresponding item. I also able to calculate the item-value. but I am not able to calculate the total of the item-value. I am sharing the formula which I am using.
For Serial Number #SL=>
numberVar numSlno = 0;
IF PREVIOUSISNULL({ICTRED.ITEMDESC}) THEN
numSlno := 1
ELSE
numSlno := numSlno + 1
For Unit Price #unitPrice=>
IF {?UnitPrice}<>"" THEN
ToNumber(Split({?UnitPrice},",")[INT({#SL})])
For Item-Value #ItemValue
{ItemTable.qnty}*{#unitPrice}
Now I am trying to get the summary of #ItemValue.
Thanks in advance.
I got the solution, I used three-formula trick for #ItemValue and its working.
I have a data in database which gives me 8 rows based on date range out of which 5 are HCT, is there any formula in crystal report where I can get that count of those 'Abbr' ?
I am comparing HCT text from Dynamic report selection, I need to know can we create a variable which gives us count of 'Abbr'.
like for
HCT should return 5
US should return 2
RN should return 1 value.
UPDATE 1:
Here is what I am trying to do. I have secondary selection criteria as Dynamic report along with date range.
in the above example I have selected only "HCT", now even though sql data is returning 8 rows (HCT,US,RN) I need only the HCT count i.e. 5.
If I select "HCT" and "US" in the secondary criteria then I should get count of both HCT and US i.e. 5 + 2 = 7.
if I am not selecting anything then it should return 0, so irrespective of the data from DB, the value should be summed based on selection of my criteria.
am I clear enough?
Use Running Totals.
Specifically, make a Distinct Count running total for each Date Range code. You can set a formula in the Running Total Wizard to only evaluate records where, for example, {DateRange} = "HCT"
I found the solution for my question, I am just putting it here so that someone may help for the above mentioned formula.
This is what I did
Created a Formula(not running totals) by name SumOfSkills
if({Command.GlobalSkillAbbr} in {?GlobalSkill}) then 1 else 0
here Command.GlobalSkillAbbr is my "HCT" and '{?GlobalSkill} will contain all Global skills.
and used another formuala to sum it up.
Sum(SumOfSkills)
which gives me desired output.
I have created a crystal report in CR9 that shows all live orders.
Each live order has several operations associated with it and each of those have a status (basically if it is null it is incomplete, if it is 9 then it is complete).
So for example:
Order 1 - 200 - Pieces of Steel
Op 1 Issue Bar (null)
Op 2 Cut bar 9
Op 3 Deburr Bar (null)
Basically what I want to do is put the last completed operation on the same line as the order. So in the above instance, the last completed operation is Op 2 (cut bar) because it is the latest operation number that contains a 9.
I've set it up so the order number is the group and the details are the operations.
I've looked at using Maximum() by group but I don't know how to do a maximum where a condition is true statement. The maximum just returns the latest one alphabetically anyway and I need it in relation to the op number.
I've also tried suppressing the results but I don't know how to just report on the suppressed results.
I can't use select expert to just display operations where status = 9 because there are some jobs that don't have any completed operations and these need to appear on the report too.
assuming op number is always in the format of Op # Create this formula in detail section then use Maximum() summary on this formula in group header. You can delete this formula from detail
numbervar a := tonumber(split({table.op#}," ")[2]);
numbervar b;
stringvar output;
if {table.finished} = 9 and a > b then
(b:= a;
output := {table.op#} & " " & {table.op_description}
);
output
Thanks very much for taking the time to respond and suggest answers. CoSpringsGuy yours pointed me in the right direction.
I simplified it by just displaying the op number & " " & description if the status of the op was 9, else "". Then I just did a maximum() on the formula.
I think I must've had brain freeze or something prior to posting :)
Thanks again.
David.
I am using Crystal Reports XI and I'm trying to add a particular column if one column or another column is set to one.
Here is the current preview:
Username (GROUP 1)
MONTH (GROUP 2)
DATE SUBJECT TOTAL_TIME
End of group 2
End of group 1
Now I want to add the values in total_time if one of the two hidden fields contain 1 (true).
I tried using sum() function but it didn't work as it added all the times together.
I'm still new to Crystal Reports and I tried searching on google but nothing came up similar to what I need.
Any help would be greatly appreciated.
One alternative that I can suggest, You can use Parameter fields on your report.
Do the calculation on Code behind and set the calculated sum to parameter field on Page_Load event of Crystal Report page.
This parameter field will be used to display the sum on report page.
Please check this link to see
-How to create Parameter Fields:
http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/en/CrystalReports_dotNET_SDK/crsdk_net_doc/doc/crsdk_net_doc/html/crtsktutorialscrvparametersdiscretecreatingreport.htm
-How to set values in Parameter Fields:
http://msdn.microsoft.com/en-us/library/aa289936(v=vs.71).aspx
Your best option will be use "Running totals" by this way you can control the flow by keeping a condition to sum when the required column is 1.
Did you think about small trick? You wrote: I want to add the values in totaltime if one of the two hidden fields contain 1 (true).
Under these circumstances you can calculate helper field Total_Time_Conditional using formula:
Total_Time_Conditional = IIf(HiddenField1 = 1 or HiddenField2 = 1, 1, 0) * Total_Time.
This will multiply Total_Time
by 1, if any of hidden fields is 1
by 0, if both hidden fields are 0
Calculating Sum(Total_Time_Conditional) will give you expected result.
Using VS 2008 Crystal Reports, I would like to do a running total on a formula that is calculated on a group change. When I click on add a running total, this formula does not appear in the Available Tables and Fields list.
This is the logic:
On Change Group of group
if CalculatedValue > 0 then
ReportRunningTotal1 += CalculatedValue
else
ReportRunningTotal2 += CalculatedValue
Can I specify a condition in a running total? If not, how else could I do this?
More info: I am doing a running total called GroupRunningTotal of the value of db field BillableHours. At change of group, I am comparing GroupRunningTotal to a db field for that group MaxHours, and I display a result of MaxHours - GroupRunningTotal at the group level.
Appropriate today - Think of it like the electoral college - the person who wins the election does not depend on total number of votes, but of number of votes in the electoral college.
I'm interpreting your question to mean that you want to add up all the negative values in one running total (RT_Neg) and all the positive values in another (RT_Pos). How about this:
Make the RT_Neg running total. Under Field to Summarize, sum your {Tbl1}.{Amount}. Under evaluate, enter "{Tbl1}.{Amount}<0" as your custom formula. Never reset.
Make the RT_Pos running total. Under Field to Summarize, sum your {Tbl1}.{Amount}. Under evaluate, enter "{Tbl1}.{Amount}>0" as your custom formula. Never reset.
Insert both running totals in the group footer (if you put them in the header, it may not sum properly)
Alternatively, you can:
Make a custom formula "If {Tbl1}.{Amount}<0 then {Tbl1}.{Amount} else 0" and make a running total based off that.
I think one of these 2 options will get you to your goal.
You most likely cannot use one RT field as condition for other RT field. You can use formulas, placed on group footer and evaluated 'whileprintingrecords()'; in these formulas you can assign/sum into some variables and display these variables at the end of report. About like next (generic idea only, you need initialization and display routines as well):
numbervar rtcurrent := sum({somefield}, {groupfield});
numbervar rtplus;
numbervar rtminus;
if (rtcurrent > 0)
then rtplus := rtplus + rtcurrent
else rtminus := rtminus + rtcurrent;