Crystal report 2008 formula - crystal-reports-2008

Hi ,
I am new to crystal report. I have a problem to create formula :
Let's say :
I have two tables :
tbl_Details :
Emp_id Emp_nameEmp_Deptt
1 Ram MMM
2 Naresh NNN
3 kapil HHH
4 Namita DDD
tbl_Mapping :
Type1 Type2 Emp_Deptt
ButterSotch ButterScotch NNN
ButterScotch Strawberry DDD
Olive Starch MMM
Olive Olive HHH
Note : In the above tables, Emp_Deptt column is same.
Now i want to create a formula like as below :
if Mapping.Type1 = Mapping.Type2 then find Emp_Deptt in Details table and get the Emp_name.
for example :
Butterscotch = Butterscotch then Emp_Deptt is NNN matched with Details table and the Emp_name is Naresh.
if doesn't find any match then nothing to do.
Now, i want to create a formula to get the desired value and print place somewhere in crystal report.

From Database Menu select 'Database Expert'. Add tbl_Mapping & tbl_Details to the selected tables.. make sure tbl_Mapping & tbl_Details are linked with Emp_Deptt fields.
Write following in the formula editor:
if {tbl_Mapping.Type1} = {tbl_Mapping.Type2} then {tbl_Details.Emp_name}

Related

Sorting and showing specific colums

I have data that I want to sort in my google sheets; but I want to show only specific columns and not others.
Here's an example :
Name
Type
HP
ATK
Hero1
type1
10
5
Hero2
type1
9
8
Hero3
type2
[null]
7
Hero4
type2
11
6
After a =SORT() in an other sheet; I'd like to have something like this :
Name
HP
Hero4
11
Hero1
10
Hero2
9
And with an other =SORT() have this :
Name
ATK
Hero2
8
Hero3
7
Hero4
6
Hero1
5
I tried with FILTER() But I can't manage to get rid of the Type column
Of course I don't want to modify the first table
But I could use sorted tables containing only the name and not wathever value was used to sort them
EDIT :
You can create a virtual array {A2:A,D2:D} and use
=SORT({A2:A,D2:D},2,0)
or even
=SORT({A2:A,C2:C},2,0)
(Do adjust the formula according to your ranges and locale)
In your case it would be:
=SORT({A2:A\D2:D};2;0)
One
=QUERY({A:D};"Select Col1,Col4 where Col1 <> '' Order by Col4 desc";1)
Two
=QUERY({A:D};"Select Col1,Col3 where Col1 <> '' Order by Col3 desc";1)
QUERY
use:
=SORT(FILTER({A2:A\C2:C}; C2:C<>""); 2; )
and:
=SORT(FILTER({A2:A\D2:D}; D2:D<>""); 2; )
pros: SORT with FILTER is faster and more reliable than QUERY that can eat your data
also, see how to convert commas to semicolons: https://stackoverflow.com/a/73767720/5632629

Convert semi-structured data to structured data using talend BigData

Employee
Employee Type : 0130
Unit : 4189670095711234
Basic Salary : 11.00
Joined Date : 04/12/yy 06:30:05
Country : 826-United Kingdom
(123.66) --- Endof Employee -------------
R 4567 ABCD -> Len f---- i 01/14
Employee
Employee Type : 0120
Unit : 4189670095711234
Basic Salary : 11.00
Joined Date : 04/12/yy 06:30:05
Country : 826-United Kingdom
(123.66)- --- Endof Employee ------------
R 4567 ABCD -> Len f---- i 01/14
Employee
Employee Type : 0130
Unit : 4189670095711235
Basic Salary : 11.00
Joined Date : 04/12/yy 06:30:05
Country : 826-United Kingdom
(123.66) --- Endof Employee -------------
Hi,
I would like to convert the following semi-structured data to structured data using talend.
Please let me know how can i convert the data to structured form and so that i can insert it into a relational table.
Here is a solution, thanks to tPivotToColumnsDelimited component.
tFileInputDelimilted is associated with a 2 fields schema (nammed property and value) and has a special field separator which is " : " (space-colon-space).Avanced Setting options "Trim all columns" and "Check each row structure against schema" are ticked.
tMap is here to associate a rank for each input line depending the "property" name:
As you can see, the sequence name is based on the property name, so each file record for the same employee will have the same rank value.
Finally, tPivotToColumnsDelimited move on a single line all the input records with the same rank value and, most important, values are associated to the rigth property.
Set "Pivot column" as "property", "Aggregation column" as "value", "Aggregation function" as "first" and "Group by" as "rank". Select the desired filename for the output and finally you will get the desired result:
Hope this helps.

Pick the earliest date record

I have a doubt in Oracle SQl, I have to pick the earliest record based on date ranges. I have table A with
NAME.A SHOPNO YEAR.A shop key
XX 123 2013 1
YY 345 2013 2
I have table b with two columns .
SHOPNO NUMBER.B NAME.B INSERT_DATE.B
1 987 ZZ 7/13/2013
2 456 ZZ 12/1/2013
My resulting output should be
NAME.A SHOPNO YEAR.A NUMBER.B NAME.B
XX 123 2013 987 ZZ
Please let me know how it can be achieved in oracle sql
See this answer from a duplicate question for a more efficient solution using rank(). But here's the basic/simple way to do what you want.
select a.name, a.shopno, a.year, b.number, b.name
from a
join b on a.shopno = b.shopno
and b.insert_date = (select min(insert_date) from b b2
where b2.shopno = b.shopno);

How to query distinct column value when query all row data

I hava one MySQL Table
id name birthdate city
1 Owen 2011/01/01 USA
2 Mark 2012/05/01 UK
3 Marry 2011/01/01 JP
4 John 2011/01/01 JP
First,I uesd jqgrid to read all row data. But Now,I want to know when birthdate=2011/01/01,how many different city in the table.
Can don't used sql,only used jqgrid plugin?
You are looking for distinct function.
SELECT DISTINCT(city) FROM table WHERE birthday = "2011/01/01";

How to write formula to get data from two tables linked together by one column in crystal report

How to write formula to get data from two tables linked together by one column
Hi ,
I am new to crystal report. I have a problem to create formula :
Let's say :
I have two tables :
tbl_Details :
Emp_id Emp_nameEmp_Deptt
1 Ram MMM
2 Naresh NNN
3 kapil HHH
4 Namita DDD
tbl_Mapping :
Col_1 Col_2 Emp_Deptt
ButterSotch ButterScotch NNN
ButterScotch Strawberry DDD
Olive Starch MMM
Olive Olive HHH
Note : In the above tables, Emp_Deptt column is same.
Now i want to create a formula like as below :
if Mapping.Type1 = Mapping.Type2 then find Emp_Deptt in Details table and get the Emp_name.
for example :
Butterscotch = Butterscotch then Emp_Deptt is NNN matched with Details table and the Emp_name is Naresh.
if doesn't find any match then nothing to do.
Now, i want to create a formula to get the desired value and print place somewhere in crystal report.
you need to make view of the tables first, join the the two tables, tbl_Deetails with tbl_Mapping..
link them with the department ID.. once its done, call that view to the report and use the formula like this
if(totext({view.Type1}) == totext({view.Type2})) then
(
{view.Employee_Name};
)
else
(
//nothing
)

Resources