Displaying record based on the condition in Crystal report
Hi All,
I want to display certain records in crystal based on some condition.
For example,
If I am having 5 student records like,
Name Mark1 Mark2 Mark3 Total
aaa 40 50 60 150
abc 30 60 40 130
tcr 25 25 25 75
Now in table i have only 4 fields (STUNAME, MARK1, MARK2, MARK3).
I have to calculate the total at runtime and if total is greater than 150, then actual record should display in report.
For example, I can use formula to calculate total but I can calculate total only after each record prints. But i want to calculate total internally only it should display in report if condition satisfies. I dont want to keep one more field for total in crystal report.
Please help me on this.
If the filter is not "pushed" down to the database, then Crystal will pull all of the data into memory and then filter it there. This is not a big deal if you only have a couple of records, but it can significantly slow down a report that is pulling in more than a few records.
An alternative, if your report is just linking tables in the Database Expert, would be to create a SQL Expression that adds the three fields together. Using this in the Select Expert WILL push the condition down to the database.
If you're using a command instead of linking table, they you would add this to the Where clause of the comment. If you're using a stored proc instead of tables or a command, you would want to do this filter in the code for the stored proc.
-Dell
Message was edited by: Dell Stinnett-Christy
Similar Messages
-
Problem in displaying totals based on the Unit of measurement.
Hi,
I have Problem in displaying totals based on the Unit of measurement.
I want to display the total in the output of the alv based on the unit of measurement. for example i have three fields in the output namely
Matnr Quantity UOM
51 10 EA
61 10 KG
71 10 KG
In the total i should get
10 EA
20 KG
Can anyone tell me how to do this?
The basic req is the exclude the qty with unit EA(each) in the totals.
Thanks,
AmitH i,
you can use the collect statement
to get the proper result
loop at itab. ( all the records)
move all the fields from itab to another
collect itab1.
write: itab1-fields, itab1-fields.
endloop.
this will solve your problem
reward points if helpful,
thanks & regards,
venkatesh -
Select records based on the closest given time
Dear SQL gurus,
I have a table T1:
Name Null? Type
ID NOT NULL NUMBER(5)
MOMENT NOT NULL DATE [DD.MM.YYYY HH24:MI]
MEASUREMENT NOT NULL NUMBER(8,3)
Example (ID, MOMENT, MEASUREMENT)
-- START OF EXAMPLE --
9380 18.11.2000 03:45 17.6
9380 18.11.2000 04:30 17.3
9380 18.11.2000 05:45 16.8
9380 18.11.2000 06:15 16.8
9380 18.11.2000 07:00 16.2
9380 18.11.2000 07:30 16.2
9380 18.11.2000 08:15 16
9380 18.11.2000 08:45 15.7
9380 18.11.2000 09:30 15.4
9380 18.11.2000 10:00 15.4
9380 18.11.2000 11:15 15.4
9380 18.11.2000 11:45 15.4
9380 18.11.2000 12:30 15.4
9380 18.11.2000 13:00 15.4
9380 18.11.2000 13:45 15.4
--- END OF EXAMPLE --
How to select records based on the:
- time period specified by the day only [DD.MM.YYYY] - CONDITION 1
- with values for 6AM only, and if not available, with values closest to 6AM - CONDITION 2
(if the time gap in MOMENT field is too big, lets say > 5h then choose the average between the value before 6AM (ex. 4:15AM) and the value after the 6AM (ex. 9:45AM))
CONDITION 1 (something like): moment between '01.01.2005' and '31.12.2004' - this is OK
CONDITION 2: I do not know how to formulate, especially if 6AM value is not availabe, and I have to find the closest available value, or get the avergae from the two adjacent values.
Maybe cursor magic??? Thanks a lot for your help.
RadoAbout condition two, would the following select be of use to you? Picking the first record could be achived by rownum, analytic function, etc.
WITH t1 AS (SELECT 9380 id, TO_DATE('18.11.2000 03:45', 'dd.mm.yyyy hh24:mi') moment, 17.6 measurement
FROM dual
UNION
SELECT 9380 id, TO_DATE('18.11.2000 04:30', 'dd.mm.yyyy hh24:mi') moment, 17.3 measurement
FROM dual
UNION
SELECT 9380 id, TO_DATE('18.11.2000 05:45', 'dd.mm.yyyy hh24:mi') moment, 16.8 measurement
FROM dual
UNION
SELECT 9380 id, TO_DATE('18.11.2000 06:15', 'dd.mm.yyyy hh24:mi') moment, 16.8 measurement
FROM dual
SELECT id, moment, measurement, diff
FROM (SELECT id, moment, measurement,
moment - TO_DATE(TO_CHAR(moment, 'dd.mm.yyyy ') || '06:00', 'dd.mm.yyyy hh24:mi') diff
FROM t1
ORDER BY abs(diff) asc, SIGN(diff) desc;
C. -
SQL Query to retrieve the All records based on the Max Dates.
Hello all,
I am trying to retrieve the newest record based on the date field ( nextDate ).
Currently there are only 4 records in the MC_Maintenance table and two in the Machine table.
Machine table
MC_id EquipID
1 0227
MC_id EquipID
2 0228
MC_Maintenance table
Maint_id MC_id Next_maint
1 2 08/25/2010
2 2 07/01/2010
3 1 06/11/2010
4 1 07/11/2010
What I am trying to accomplish is,
list the two machines from the Machine table with the MAX(Next_maint) controlling the MC_Maintenance output list
These are the records that I would like to Display.
Maint_id MC_id Next_maint
1 2 08/25/2010
4 1 07/11/2010
Below is the SQL Query
SELECT
MC.MC_ID as ID,
MC.complete_Date as completed,
MC.next_maint as nextDate,
MC.maint_notes as Notes,
MC.facility as Facility,
M.EquipId,
M.name as name,
M.SerialNumber as SN,
M.dept as dept,
M.Freq as freq
From MC_Maintenance MC, Machine M
where MC.MC_ID = M.MC_ID
' USING MAX(nextDate )
Any ideas would help.
TJI would have thought that was a simple group by problem?
SELECT M.EquipID, MC.MC_ID, Max(MC.next_maint)
FROM MC_Maintenance MC INNER JOIN Machine M ON MC.MC_ID = M.MC_ID
GROUP BY M.EquipID, MC.MC_ID -
Can we take standard report for all sales orders based on the condition typ
Hi all,
Based on the condition type, we need to take a report for sales orders on the particular date.
Thanks and Regards.....VMHello again.
Searching for a solution, I found a Logical Database for sales orders, that have all the information that you need.
Using like reference the post of Bhagavatula, in the same transaction SQVI you can use, instead of the suggested join, you can select a logical database called VAV in Data source.
This logical database links the tables, VBAK, VBAP, VBUK and KONV that is the central point of the question.
You can list the information of logical database using the transaction SLDB.
In 'Logical Database' inform VAV.
Press F8 to list all the fields.
More information about logical database in:
Link: [SAP Logical Database|http://help.sap.com/saphelp_46C/helpdata/EN/9f/db9b5e35c111d1829f0000e829fbfe/content.htm] -
How to create a record based on the name of a file in the file-system?
Hi,
With a lot of pictures I want to have a database to gather some information about these pictures.
First question is how to generate a record based on a file in the file system?
e.g. the pictures are "c:\fotos\2009\01\disc_001.jpg" to "c:\foto\2009\01\dis_98.jpg" .
now i want to create records with as one of the attributes the name of the picture (not the picture itself). how to create these records (based on the information of the file-ssytem). i.e. the number of records should be the same as the number of pictures.
any suggestions?
any reaction will be appreciated.
LeoLink to Create directory
http://www.adp-gmbh.ch/ora/sql/create_directory.html
You can create a list of files in the directory and read the list files from that directory.
[UTL_FILE Documentation |http://download.oracle.com/docs/cd/B14117_01/appdev.101/b10802/u_file.htm#996728]
[Solution using Java|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:439619916584]
SS -
Retrive Records based on the content in a Clob Feild
Retrive Records based on the content in a Clob Feild
I have a Table NoteFile which contains a Clob Feild NoteFileContent
and is refrenced by PK DocID
i need to Match DocID with other Tables Document and folderdocument
My Query is as Below
SELECT Doc.Pap_Doc_ID, Doc.Pap_Doc_Name , NF.NoteFileContent
From NoteFile NF , Document Doc, folderdocument FD
Where Doc.Pap_Doc_ID = FD.FoldDoc_ID and FD.FoldDoc_ParentID <> 3 and
NF.DocID = DOC.Pap_Doc_ID And NF.NoteFileContent Like '%a%'
The above query throws
ORA-00600: internal error code, arguments: [504], [0x7ADEBE00], [2], [1],
[cache buffers chains], [723], [0], [0x7ADEBE00]Hi,
We can resize it.Always give the height and weight in
percentage format. and turn off the horizontal n vertical scroll
policy in u r main application.
Hopes it helps you... -
Inserting new columns based on the condition!
Hi guys,
I have a very simple query like the following…
SELECT table2.column_code2,
table2.column_description2,
table2.column_code1,
table1.column_description1
FROM database_001.table2 table1 LFET OUTER JOIN database_001.table2 table1 on (table2.column_code1 = table1.column_code1)
From this query, its returning me a result set of something like below:
column_code1 column_description1 column_code2 column_description2
RO1 BOOK RL1
PDF/ECOPY
RO2 PAPER RL2
CONFERENCE
RO5 JOURNAL
RL11 OTHER
Now, on the above query I want to insert three extra columns with the name (status, location and contact) where the results in the extra three columns would be based on the conditions I want to define in the query based on the above results…
Something for example (sorry, I am not trying to write a condition: my question is how to write it),
if column_code1 = RO1 and column_description2 = PDF/ECOPY on status column it should return a value ‘ONLINE’ & on location column it should return ‘WEB’ and on contact column it should write ‘BOB’.
Also,
if column_code1 = RO5 and column_description1 = JOURNAL on status column it should return a value ‘ON PRESS FOR PRINT’ & on location column it should return ‘S.R STREET, LONDON’ and on contact column it should write
‘SMITH’ like below result…so the final output should be the top four columns and the extra three columns…I hope someone can help me into this…thanks a lot…
status location
contact
ONLINE WEB
BOB
ON PRESS FOR PRINT S.R STREET, LONDON SMITHHi artistdigital,
you can use case statment for same in sql server. MSDN link - > http://technet.microsoft.com/en-us/library/ms181765.aspx
Try code like this:
SELECT table2.column_code2,
table2.column_description2,
table2.column_code1,
table1.column_description1,
case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'ONLINE'
when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'ON PRESS FOR PRINT'
end as [status],
case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'WEB'
when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'S.R STREET, LONDON'
end as [Location],
case when column_code1 = 'RO1' and column_description2 = 'PDF/ECOPY' then 'BOB'
when column_code1 = 'RO5' and column_description1 = 'PDF/ECOPY' then 'SMITH'
end as [contact]
FROM table2
join table1
on table2.column_code1 = table1.column_code1
Regards Harsh -
Need to show the images in calculated column based on the condition in sharepoint 2013.
Hi ,
I'm working in sharepoint 2013, In this i want to show an image in calculated column based on the condition, but image is not showing .
In sharepoint 2010 its working with help of javascript in content editor on the same page. Same thing i tried in SP 2013. but doesn't work.
Could any one please give proper solution for this?
Thanks in advance.
by,
Siva.Hi please provide the JS you have used in the content editor as well as the calculation for the column so we can better understand what's maybe differs?
Blog: chrisstahl.wordpress.com Twitter:
@Cstahl -
Web GUI new feature - creating a new record based on the current record
Vincent,
We need new feature in Web GUI:
creating a new record based on the current record with data
from Moscow with moneyIt is already enabled, in the next release.
If you joint TAB program, the march preview build contains it. User can select 1 or multiple users and make a copy. -
How to display help based on the Jlabel description
Hi all,
I try to display help based on the Jlabel description. When a user click on the help button, I want to use the label description to match correct help topic and display on the screen. I have following code as Field-level help but it returns error. Looks like I cannot use jLabel1.gettext() dynamically. Please let me know if you have any idea!
String st = jLabel1.getText();
URL url = HelpSet.findHelpSet(null,"preferences.hs");
hs = new HelpSet(null,url);
hb = hs.createHelpBroker();
hb.enableHelp( jLabel1, jLabel1.gettext(), hs );Thanks,
NYYou did notice that this is the Forms Forum right???
If not then click [url http://forums.oracle.com/forums/forum.jspa?forumID=84]Here
Tony -
Display data on OLE object (form) in Crystal Report
Hi All,
I m using Crystal Reports 2008. We have Business Objects XI 3.1 SP3 environment.
I have a crystal report with OLE object embedded in it. The OLE Object is a form on which the database fields and the formula fields are supposed to be displayed. The OLE Object form has multiple lines (rows) and sections. I have a formula field that sometimes brings multiple records and I want to be able to display those records as rows (one below the other) on the same page until all rows on the form are filled. I have 2 problems:
1. When the formula field brings more than 1 record, only one record is displayed on one page and the next record goes and prints on the next page i.e. the records are not being displayed below each other.
2. How do I make sure that the records display on the next page of the report once all empty lines/rows on the OLE object form are filled?
Your replies are much appreciated.
Thank you.Hi,
if I understand correctly, your OLE object is a form and your data needs to display on it.
What you can do is, inserting the OLE object on page header and then in the section expert, click "Underlay the following section".
Note that the structure of Crystal report is RH, PH, GH, Details.
So, if you insert OLE object in Page Header (PH) and you have a group, underlaying the OLE means displaying the object underlay Group Header (GH).
So, it is a bit of twisting to do and your OLE object needs to fit well as in A4 (or the paper size you need) consistently. -
How to use the DLL in crystal report (Additional applications)
Hi,
i have created a win32 dll, and now i want to use that dll in my crystal report how can i do so?, what i tried is i went to to Addntional functions catagory in formula workshop, and there i can see some dlls listed, similary i put my dll in the same path like "C:\Program Files\Common Files\Crystal Decisions\1.0\Bin" and other folder too. but i am not able to see that dll in "Addtional functions". can you plesase tell how can i achive this.
Regards,
Prabhakar J.Please re-post if this is still an issue to the .NET Development - Crystal Reports Forum or purchase a case and have a dedicated support engineer work with you directly
-
Change the language of Crystal Reports XI
Post Author: damden
CA Forum: General
When I start Crystal Reports XI the program is in the language Dutch.I'm living in The Netherlands, but my Windows XP is the English version.I want to change the language of Crystal Reports, but how do I do that...Post Author: damden
CA Forum: General
V361:If you are not on product version 11.5.8.963 (help, about CR) you will need to download the latest hotfix, or R2 upgrade. When you run that, it will prompt you for language as part of the process. I've installed R2 (upgrade). And when installing I selected the Englisch language. But this is de language the setup is in, this is NOT the language of Crystal Reports when it is installed completely.The language of my installation is still Dutch. My product version is now: 11.5.8.826 -
How to center the content in crystal report viewer?
open crystal report viewer in winform, default at the left top
after maxmium the winform window, content become at the center
another odd thing is that i set window winform size 1208*1024 and crystal report view is fill
then tried, content is not center any more
How to center the content in crystal report viewer in code?
Edited by: Mathew_666 on Oct 6, 2011 5:20 AMSince there is no control for center you'll need to do the math on your own. This is just a rough draft, but you'll get the idea.
One of the things you'll need to figure out is your buffer to help you give a centered feel. We'll say that value is 50 in this case.
Height
int buffer = 50;
int formHeight = 1000; // we'll assume a height of 1000 in this case
int crystalTop = buffer;
int crystalViewerHeight = formHeight - (buffer * 2); // buffer is at the top and bottom
Width
int formWidth = 1000; // we'll assume a width of 1000 in this case
int crystalLeft = buffer;
int crystalViewerWidth = formWidth - (buffer * 2); // buffer is at the top and bottom
Maybe you are looking for
-
Help!! What's going wrong here. I used to have iTunes installed on this computer but lost it when it crashed. I've tried re-installing it numerous times but I keep getting the same error message. "Error writing to file: C:\ProgramFiles\iTunes.Resourc
-
Error msg : Message no. IO304 while delivery for serial no.
Hi, In serial no. profile we have maitain MMSL Maintain goods receipt and issue doc. 03 01 PPAU Serial numbers in PP order 03 01 PPRL PP order release 03 01
-
The Problem about clearing the system cache
Hi, there! I'm trying to draw a lot of image in iPhone programming. I used [UIImage imageNamed]. but it doesn't clear immediately the system cache. At last it occurs the out of memory. So I thought using imageWithContentsOfFile, but it works very slo
-
Refresh rate for client tracking i WCS/MSE
Hi I have a customer that have trouble with the update of the position of a client. Even if the clients walks across the whole building, the client will stay at the same place for several minutes. Is there any way to tune the refresh rate? When I pus
-
After upgrading to iOS6 some of my message contents got deleted when I view them
After upgrading to iOS6 my older message contents are deleted when I open it