I am relatively new to using Crystal Reports. I am pulling the correct information from my database however I need to only pull the information from the beginning of the month to the current date, i.e. 09/01/2013 - 09/23/2013. Could anyone give me a snipit of code on how that would look.
Much appreciated.
The best way is you need to filter the data before it is populated on reports i.e. filtering the query itself. The other option is to create new parameter for the selected field and passing the value on runtime.
http://www.codeproject.com/Articles/205398/Crystal-Report-Filtering-Using-Selection-Parameter
In below figure you can add the records selection on the required field and add the condition similarly
Related
I am using Microsoft Access 2016. I am trying to find out how many years exist from the current year until a future year. I have a column that is end_date. I am trying to create a calculated field that is essentially YEAR(end_date) - YEAR(current_year). I tried to use YEAR(DATE()) but DATE() is not allowed to be used in a calculated field apparently.
Is there no way to do a calculation like this?
Nope. Calculated fields are cached and static, so are NEVER allowed to contain ANY information that will change over time, due to system settings, or anything else that is not directly entered in that row.
However, you should not be using calculated fields anyway. See http://allenbrowne.com/casu-14.html, among many posts advocating for not using calculated fields.
Instead, use queries to do calculations. That way, you won't have any trouble using the current date, and won't have to deal with the possible errors and portability issues calculated fields come with.
I changed my thinking to calculate this in a form. It does not seem good practice to have a field in a DB that changes everyday.
In a form, you can use this expression as controlsource for a textbox:
=DateDiff("yyyy",Date(),[EndDate])
However, that return the difference in calendar years. To find the count of full years, use a function like AgeSimple and this expression:
=AgeSimple([EndDate])
I have a problem to display a date in crystal reports. The field is from database, and it shows the time, too. I need to display only the date.
I observed that if I click on the Text Format from the date, in the Font tab at Sample it is showed with time. I think that is the problem, but I can't modify, I can't delete the time from the Sample box.
Do you have any idea how to resolve this?
The data-type of the column inside the database seems to be text/varchar instead of datetime.
The best would be to fix the data-type on the table inside the database.
If you don't have the option to change the datatype directly on the database, you can use following formula to convert it to DateTime inside the report.
If IsDate({Table.DateTimeColumn}) Then DateTime({Table.DateTimeColumn})
On the properties of the formula field there will be the option for the different formats then.
I have a problem with Crytal Report (CR) 2013, my customer want to default current date in parameter fields in Crytal Report when they open it. I try to do it with many ways but it not work. i'm looking forward to ur help. Tks all.
Current form
The only way I know to set a current date to a report parameter is by adding your report as a subreport and passing a formula returning current date as a source for the parameter. You may add also a parameter for date in the main report and inside the formula check if the provided value is for example 1/1/1900 then use current date. This will work if you do not have subreports in your report ( Crystal does not support nested subreports) and the user should be aware that date 1/1/1900 should be selected for current date.
Generally speaking default values should be handled by the software , which is running the report. Ask your customer to try application like this one: http://www.r-tag.com/Pages/CommunityEdition.aspx.
I am posting the link because this software is free. My guess is that there are other applications , which are able to set default values for report parameters. You can do your research. Here is a sample video setting a default value for date: http://www.r-tag.com/Pages/Preview_ParameterTemplates.aspx
The video is for different report type, but Crystal reports will be handled in the same way.
I am a colleage of Hai Pham. I give you more information about this issue.
1. datasource: stored procedure
2. set current date is default value in import parameters popup
popup image
3. users can select another value
Thanks,
Dai Nguyen Quang.
I have this concern using Crystal Report which I am not really familiar with. Here's my scenario:
I have an existing report to update, I need to add a column (ETA) which has a datetime value. It may return more than one rows per Item No, I need to get the minimum date only per Item No from the result rows.
I already tried some solution mentioned here http://scn.sap.com/thread/1952829 but found no luck.
I used a suppression formula for the Details section of the report, but haven't succeeded yet.
IF {TableName.DateField} = Minimum({TableName.DateField}) THEN FALSE ELSE TRUE
Any possible things you can suggest me to try? Thanks in advance for this :)
good to get this value from sqlserver side. you just create a function which return a single data (minimum date).
If you wish in crystal report side, it is something you make loop of hundred for a single row display. You can use running total field for this.
Select the field , select summary type and put into the detail section.
or you can create a formula with group name option like
Minimum({TableName.DateField})
http://scn.sap.com/thread/1952829
http://businessintelligence.ittoolbox.com/groups/technical-functional/businessobjects-crystal-l/unable-to-filter-based-on-the-first-date-in-list-of-dates-4912881
please check
Running total field gives options for Min, Max, etc. but not Sum
http://flylib.com/books/en/4.229.1.28/1/
I'm trying to create a Crystal Report that reads data from an access table. I have a particular field in the access table called REPT_YYMM. This is basically a run data field, so each month when a program is run it populates the current year/month in the field before exporting to access, so there is a way to do month to month comparisons. For the report I'm working on I just want to display the data along with the current REPT_YYMM field when the data is refreshed on a monthly basis. Is there a way to do this in a formula. I'm not familiar enough with date type functions to know where to start.
Any guidance or suggestions are appreciated!
Your question isn't very clear but if i understood correct you just need to filter the data where field REPT_YYMM = YYMM.
Goto selection formulas, record and enter:
{table.REPT_YYMM} = cStr(currentdate,'yyMM');