Sub report links in crystal reports - crystal-reports

I have a report having a command object where I have empno and some columns. And I have another command object which also having empno.
For 1st command the parameter is division and based on division I will get some empnos in 1st commnd object and I need to pass this empnos from 1st command object to 2nd command object.
So that the 2nd command object should get some empnos from 1st command object and should display countries based on the matched empnos .
So I linked both command objects empnos in links tab.
Due to some performance issue I am doing like this
Created a sub report with 2nd command object and created empno parameter. Now in sub reports links tab I am passing main reports empno to sub reports empno parameter.
But I am getting non matching empnos data.
Please suggest
Here what I observed in my 1st table have data like this.
eno name division
1 aaa 2
2 bbb 2
3 ccc 2
In my 2nd table I have data like this
eno country division
1 India 2
2 Aus 2
By using 1st method(linking command objects in links tab).
I am getting result like this.
eno name division country
1 aaa 2 Ind
2 bbb 2 Aus
By using 1st method(Sub report approach).
I am getting result like this.
eno name division country
1 aaa 2 Ind
2 bbb 2 Aus
3 ccc 2
I need to get only employees present in both tables using sub report approach.
Please suggest
Hi Siva i am unable to post the image I am getting data like this.In my 2nd table I have onlt enos 1 and 2 .But I am getting all the emps even I used record selection formula also
**eno name division country
1 aaa 2 Ind
2 bbb 2 Aus
3 ccc 2**

when you use sub report for this purpose then you should not link parameters of main report to sub report instead you should use the linked parameter in Record Selection Formula of sub report then your filtering applies to sub report.
for e.g:
pass the parameter to sub report through links (Take care dont link the parameters) then you will get siomething like this {pm-parameter1}.
then go to record selectoin formula and write as
database field = {pm-parameter1}

Related

Accumulated value

I am coming across an issue wherein I am trying to lookup a Cost to a file with multiple rows for a project, but it's not working out, as lookup is repeating the cost for all the rows and thereby not providing the correct cost associated with a project. Here is how the file looks in which I am trying to lookup the value:
Date Project
1/08/2017 XYZ
2/08/2017 XYZ
3/08/2017 XYZ
4/08/2017 XYZ
5/08/2017 XYZ
6/08/2017 XYZ
1/09/2017 ABC
2/09/2017 ABC
3/09/2017 ABC
4/09/2017 ABC
5/09/2017 ABC
6/09/2017 ABC
12/10/2017 DEF
13/10/2017 DEF
11/11/2017 IJK
And here is the file form which I am trying to lookup the value from:
Project Budget
XYZ 200000
ABC 300000
DEF 1000000
IJK 50000
Any help is highly appreciated. Also how can I count a project is repeated in the field. I am looking for something like this :
Date Project Count_Projects
1/08/2017 XYZ 6
2/08/2017 XYZ 6
3/08/2017 XYZ 6
4/08/2017 XYZ 6
5/08/2017 XYZ 6
6/08/2017 XYZ 6
1/09/2017 ABC 6
2/09/2017 ABC 6
3/09/2017 ABC 6
4/09/2017 ABC 6
5/09/2017 ABC 6
6/09/2017 ABC 6
12/10/2017 DEF 2
13/10/2017 DEF 2
11/11/2017 IJK 1
I really need to figure this out.
For your second question, you can create the Count_Projects calculated column as follows:
Count_Projects =
CALCULATE(DISTINCTCOUNT(Dates[Date]),
FILTER(Dates, Dates[Project] = EARLIER(Dates[Project])))
Or you can use a variable:
Count_Projects =
VAR Project = Dates[Project]
RETURN CALCULATE(DISTINCTCOUNT(Dates[Date]),
ALL(Dates), Dates[Project] = Project)
Like #Alexis Olson, I'm not clear as to exactly what output you expect; but, assuming that you want to see the same Budget number listed for each respective Project entry (e.g., 200000 for each instance of XYZ, 300000 for each instance of ABC, etc.), here's an answer.
If you've got both tables loaded into PowerBI, As seen from the right side of the screen in the Data view (I named them Table and TableLookup):
If you click Home -> Manage Relationships, you'll see there is a relationship between the two tables:
If you then click Edit..., you'll see it's a Many to one relationship between the overall table (I called it Table) and the lookup table (I called it TableLookup):
Anyhow, the point is...there is a relationship between the two tables, and you're going to use it.
Click Cancel.
Click Close.
Click Modeling -> New Column; then, in the formula bar, type:
Budget = RELATED(TableLookup[Budget])
and enter. You'll get this:
Then you can do what Alexis said for counting:
Click Modeling -> New Column; then, in the formula bar, type:
Count_Projects =
CALCULATE(DISTINCTCOUNT('Table'[Date]),
FILTER('Table', 'Table'[Project] = EARLIER('Table'[Project])))
I replaced Alexis's "Date" with "Table" because my table is named Table.
You'll see this:

Crystal Reports - Checking for a row in a table based on criteria from two different columns

I have a table of jobs, with columns showing which engineer the job is assigned to and the area of the country, which can be simplified like this:
JobNumber Area Engineer
1 A 3
2 D 1
3 E 2
4 B 2
5 A 1
I have a table of engineers, and a table of areas of the country.
I have a final table which shows the areas of the country each engineer is assigned to, like this:
Area Engineer
A 1
A 2
A 3
B 2
B 3
What I need to do in Crystal Reports, is create a formula field (or similar) to show whether or not the engineer was in one of his assigned areas.
I think the reason my efforts thus far have failed is that the join is effectively circular. I have played around with SQL Commands and join options to no avail.
Can anybody offer advice on how I can solve this problem?

Group items based on a formula

I am creating an invoice using Crystal Reports & I want to group products which have the same PRO_ID into one line, for this I have created a GROUP and it works fine.
Following is a sample of the data
PRO_ID NAME ORDER_QTY
0001 Battery 2
0001 Battery -6
0001 Battery 3
In the second line the quantity is a minus because of a returned item. I want to show the actually ordered items separately & returned items separately.
At the moment the report shows -1 for the ORDER_QTY because it just groups the Products based on the PRO_ID. How can I group these separately ?
try this:
Keep PRO_ID as it is as the first group and then create a sub group #group2 and write below code:
if ORDER_QTY<0
then "Returned"
else "Actual"
Use #group2 to group after PRO_ID.
Now place the all your fields in details.
hope this helps

Cross tab report in Crystal Report

I am quite new to cross tab type reports in crystal report and I want to show multiple users multiple details.
So that I have columns as username and row containing details of the same.
Like:
User1 User2 User3 User4 User5
Details1: aaa bbb ccc dddd eeee
Details2: 123 345 534 566 87667
Details3: geg dhrth htrhytr ghdf ytryr
But I am unable to get the interface as total, subtotal summary etc fields are quite confusing.
Also I am not interested in grouping my rows on the basis of one field and then showing details in it.
Create a cross tab report and in Row area you put Your details and in column are you put your user, and don't forgot to put the Summarized fields. It works fine. No need to do any coding all the things should manage from your stored procedure.

counting fields based on group in crystal report

hi all i wana ask a question about crystal reporting in vs 2008
lets say i have a report with these data
customer_ID Customer_Name Order_amoont Order_Date
(#group1 VipCustomer)
1 xyz 3 1/1/2010
2 abc 4 2/2/2010
5 sds 21 3/12/2009
(#Group2 NormalCustomer)
3 tyt 2 3/3/2010
4 ha 4 21/3/2009
i want only to display records where Order_Date year is in 2010 only so i went to the section expert and i added a condintion in suppress formula Year(order_Date)=2010 and i get the result ,,the question is how to count how many vip customers ordered in 2010 only and how many normal customer order in 2010 only ,,then i want the total number of both type of customers to be displayed to have a report like that::
customer_ID Customer_Name Order_amoont Order_Date
(#group1 VipCustomer)
1 xyz 3 1/1/2010
2 abc 4 2/2/2010
subtotal 2
(#Group2 NormalCustomer)
3 tyt 2 3/3/2010
subtotal 1
total 3
i know that answer ,and i will answer it
1-make a conditional formula field and add to it this condtion
if year(Order_Date)=2010 then 1
2-then add summary to the formula filed
--to get total place this summary in the report footer
--to get sub-total place this symmary in group footer
there is also another way to do it
by using running total field and it evaluate section us the formula year(Order_Date)=2010
then to get total place the running field in report footer
to get sub-total make a new running field the same as the 1st but in the reset section check on reset of change of group and place this field in group footer
thnx