Crystal Report Function

Post Author: y.moreau
CA Forum: Formula
I would like to convert a date as a week number. First week of the year is Week 1, week of April 12th is week 15.Thanks in advance for your help

Post Author: wapper
CA Forum: Formula
As a fellow european, I have to warn you: never trust american software when it comes to week numbers. In Europe, we mostly use ISO week numbering. ISO standard states that a week always starts with monday, and the first week of the year is the one that have first thursday of the year. See http://www.cpearson.com/excel/weeknum.htm
Americans use sunday as first day of the week, and I'm not quite sure whether they have a single commonly accepted rule for calculating week numbers.
The DatePart function you mentioned will calculate the week numbers incorrectly for certain dates (at least in version 8.5 I am using):
DatePart ("ww", {test_date_range.value}, crMonday, crFirstFourDays)
will display invalid values for:
date
Crystal
ISO
31.12.2001
53
1
30.12.2002
53
1
31.12.2002
53
1
29.12.2003
53
1
30.12.2003
53
1
31.12.2003
53
1
31.12.2007
53
1
29.12.2008
53
1
30.12.2008
53
1
31.12.2008
53
1
As a matter of fact, there is no week 53 in year 2007 or 2008 according to ISO standard.
As far as I know, there is no built-in function in Crystal Reports 8, or Visual Basic 6, or MSSQL, that will calculate ISO week number properly. In Crystal, I use a function like following:
//Advanced formula for calculating ISO week number and year for this week number//http://www.cpearson.com/excel/weeknum.htm
numberVar numTemp;numberVar ThisYear;dateVar PreviousYearStart;dateVar ThisYearStart;dateVar NextYearStart;
numberVar tmpWeekDay;dateVar tmpNewYear;
numberVar ISOWeekNum;numberVar YearNum;
datetimeVar datDate := {test_date_range.value};
if datDate <> Date(0,0,0)then (
    //ThisYear    ThisYear := Year(datDate);
    //ThisYearStart  - find Monday closest to Jan 1    for numTemp := -4 to 4 do    (      tmpNewYear := DateSerial(ThisYear, 1, numTemp);      if DayOfWeek(tmpNewYear,crMonday) = 1 then ThisYearStart := tmpNewYear    );        //PreviousYearStart - find Monday closest to Jan 1    for numTemp := -4 to 4 do    (      tmpNewYear := DateSerial(ThisYear-1, 1, numTemp);      if DayOfWeek(tmpNewYear,crMonday) = 1 then PreviousYearStart := tmpNewYear    );
    //NextYearStart - find Monday closest to Jan 1    for numTemp := -4 to 4 do    (      tmpNewYear := DateSerial(ThisYear+1, 1, numTemp);      if DayOfWeek(tmpNewYear,crMonday) = 1 then NextYearStart := tmpNewYear    );
    if datDate >= NextYearStart    then     (        ISOWeekNum := (datDate - NextYearStart) \ 7 + 1;        YearNum := Year(datDate) + 1    )    else        if datDate < ThisYearStart        then         (            ISOWeekNum := (datDate - PreviousYearStart) \ 7 + 1;            YearNum := Year(datDate) - 1        )        else        (               ISOWeekNum := (datDate - ThisYearStart) \ 7 + 1;            YearNum := Year(datDate)        );
ISOWeekNum)
Hope it helps.
Denis

Similar Messages

  • Crystal Reports functionality from Save The Cat

    Sorry if I've missed this in the presentation video since I've only watched half of it, so I have no idea if this has been considered for development.
    I use "Save The Cat" from Blake Snyder to storyboard my scenes with Crystal Reports - minus his structure.. and I create my own story templates and then drop the whole thing into "Final Draft".
    If I had the flexibility to setup and re-use "structure" templates that would contain my scene cards with an overview of my scene cards as the structure under my script and the ability to toggle between the two...then where do I sign on the dotted line?
    If you could integrate this functionality into this software - and as I say, I'm not sure if you've done this - then I'm sold. In other words, you build with the cards, and worry about the script later.
    Cheers,
    C.

    I need more info from you. I have looked for info re. Powerbuilder 11.5 here:
    http://www.sybase.com/products/modelingdevelopment/powerbuilder
    but I can not find any mention of Crystal Reports as it would apply to Crystal Reports being part of Powerbuilder 11.5. So, I need more explanation of this:
    I'm trying to use the Crystal Reports ocx from Powerbuilder 11.5
    Also, in the title of this post, you mention:
    Crystal Reports RDC from Powerbuilder.
    RDC and OCX are quite different technologies. It's one or the other. Thus please provide the following info:
    1) Is the CR component you are using (be it an OCX or RDC) part of Powerbuilder? Or have you purchased a stand-alone version of CR and are using the component in Powerbuilder?
    2) What component are you actually referencing?
    3) What is the version of the Crystal Reports you are using?
    Ludek

  • Can I have a SQL statement in a Custom Function in Crystal Reports 2008

    I'd like to create a custom Crystal Reports function which does a database lookup. Is this possible? In the pseudo code below "v_le_afe_xref" is a dataource in the report.  A syntax check fails on the select.
    Function legal_entity_co (old_co AS number) AS number
    SELECT v_le_afe_xref.NEW_BURKS FROM v_le_afe_xref WHERE old_co = v_le_afe_xref.OLD_BURKS
    END FUNCTION
    Thanks.

    Hi David,
    Not sure where you are trying to use the function but CR doesn't support Functions directly, this changes so try Service PAck 3 to see if it's been added. Try using a SQLExpression, and do not include a SELECT in the SQL or using a Command Object.
    You may be able to define it on the server and then call it from CR using a Command also.
    Thank you
    DOn

  • Open ECC report in Crystal Reports

    Hi,
    Question, hope you have some info on this...
    I want to try & open a custom report which is built in an ECC system (report is currently run as a "Yxxx" transaction) in Crystal Reports. Purpose is to further edit and format the report using Crystal Reports functions.
    Does anyone know what path to follow here? Do I have to set up a new connection for the given source system?
    Thanks for any tips advice.
    Ps. I have Crystal Reports 2008 and also the BI Integration Kit (not sure if this is used / required).
    Thanks,
    Willem

    There are transports that the SAP Integration Kit delivered.  you may have already installed this on your BW, but they would need to be installed on ECC if you want to query there.  Once these are installed, Crystal should be able to see an SAP - Table, Cluster, Function  Data Connection allowing you to connect to your ECC.
    You should review the SAP Integration Kit doc - it spells out authorizations required, how to handle security, etc.

  • Help converting a bigint to a DateTime in Crystal Reports 2008

    The data in a table contains a bigint which needs to be displayed in DateTime in the Crystal Reports.  Can someone please describe what I would need to do within the Formula to make this happen?
    thank you.

    I need to figure out the same thing:  How do I get this into a Crystal Reports Function and call it?
    I have this in SQL and need to run it in Crystal Reports Language as a function
    Create Function dbo.GetTimeFromTicks(@Ticks BIGINT)
    Returns DateTime
    As
    Begin
    Declare @Days BIGINT
    Declare @DaysBefore1753 BIGINT
    Declare @TimeTicks BIGINT
    Declare @Seconds BIGINT
    Set @Days = @Ticks/Convert(BIGINT, 8640000000000)
    Set @DaysBefore1753 = Convert(BIGINT, 639905)
    Set @TimeTicks = @Ticks % Convert(BIGINT, 864000000000)
    Set @Seconds = @TimeTicks/Convert(BIGINT, 10000000)
    Return DateAdd(s, @Seconds, DateAdd(d, @Days - @DaysBefore1753, Convert(DateTime, '1/1/1753')))
    End
    thanks,
    Mike

  • Orange arrow link in Crystal Reports    version   sap  b1  8.8.

    Hi,
    i   try  to  create    report  in  crystal   report   sp01   8.8,  but  i  don't   see   where  is   orange   link   in   crystal   report   functionality.
    where  is   image   for   this   objects?   can  i  download  manually   the  image? 
    thank  you  so  much

    hi ,
    check below link:
    Crystal 8.8 orange link arrow to Sales Order
    or check https://websmp201.sap-ag.de/~sapidb/011000358700000882232009E/HowTo_Work_withCR_88.pdf for link arrow functionality.
    Thanks,
    Neetu

  • How to tell that Crystal Report 13.0 for VS 2010 installed on target mach

    Hi,
    I developed Windows application that has Crystal Report functionality.
    The final step is distribution application development.
    I am using Install Shield 2011 to build Basic MSI project. 
    What is the best registry key value I can use to identify the right version of Crystal Report redistributable has been already installed on target machine?
    I think I am going to use one of the key values that located under HKEY_CLASSES_ROOT\CrystalReports13.
    But which one?
    Also where can I get the minimum requirements when it comes to windows operating systems that supports Crystall Report 13.0 redistributable?
    Thank you.

    I installed CRRuntime_32bit_13.msi on Windows XP SP 3 machine, which is my testing production machine.
    1. Under Add and Remove programs there is only one entry
    -SAP Crystal Reports runtime engine for .NET Framework 4(32-bit)
    -SAP Crystal Reports, version for Visual Studio 2010 has not been installed because I think there is no Visual Studio 2010 installed on the target machine.
    2. During the installation registry keys have been created
    HKLM\SOFTWARE\SAP Business Objects\Crystal Reports for .NET Framework 4.0
    These key has another 9 sub keys I am not going to list here.
    3. After I manually uninstall runtime all registry keys have been deleted except:
    HKLM\SOFTWARE\SAP Business Objects\Crystal Reports for .NET Framework 4.0\Report Application Server
    All assemblies from GAC have been uninstalled
    win32_x86 folder has been uninstalled from
    C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0
    I hope this info will help to safe your development time.
    Happy programming

  • What version of crystal report distribution should I install? CRforVS_redist_install_32bit_13_0_5 or CRforVS_redist_install_64bit_13_0_5

    Hi,
      On Production server, we use window 2008, 32 bit machine, the application is visual studio 2010, sql 2012, what version of crystal report should I install for this production server?
      I should install CRforVS_redist_install_32bit_13_0_5 or CRforVS_redist_install_64bit_13_0_5?
      On test server, we use window 2008 R2, 64 bit machine, the application is visual studio 2010, sql 2012, I install both version in order to make the crystal report working correctly on the application.  if I miss one of them, there are some crystal report function doesn't work..
      For production server, we want to install only one, so, could you give me suggestion which version is correct version to make the crystal report work totally correctly on the VS application?
    thanks
    Kelvin

    Hi Kelvin
    First, you should really be using SP 10.
    next, if your app is compiled as 32 bit, deploy 32 bit runtime.
    If it is compiled as 64 bit, deploy 64 bit runtime.
    If it is compiled as Any CPU and deployed to a 64 bit OS, install 64 bit runtime.
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Internationalization into Crystal Reports

    Hi all,
    is it possible to translate a report automatically from one language to another, with a Crystal Reports function?
    In other words I want to localize labels used in reports
    The report was made by Crystal Reports 2008 and the report engine is Java Reporting Component (v.12.2.205)
    Thanks a lot.

    Nope, Crystal Reports will not do the translation.  Your best bet is to look for a UFL that you could use within Crystal Reports to do this translation.

  • How to integrate Crystal Report  with oracle JDeveloper 11g

    Hi,
    How to integrate Crystal Report  with oracle JDeveloper 11g
    Regards ,
    Amol

    I dont think that you can integrate Crystal Reports with JDevelpoer but you can use runtime libraries to your project to get crystal report functionality
    To know more please go through supported platforms
    [Supported Platforms|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/504d0204-681e-2b10-2381-853d88974cfc]
    Regards,
    Tej

  • How to get data from function module in crystal report

    Hi,
    I installed Crystal Reports 2008 and BO SAP Integration kit for CR.
    I connected successfully to SAP system from CR but unable to get the data into Report ...
    But data is present in function module.
    Could you please tell me what may be the reason ...!!
    Thanks
    Raghavendra

    Hi,
    I connected successfully to SAP system from CR but unable to get the data into Report with all the Input parameters and data is present in function module.
    Note: - If we take Start date as input parameter in Crystal report data is coming for single parameter, whereas we take input parameters like Partner function, Region and Customer - we are not getting data. (These fields we created parameters in Crystal report)
    In Function Module IMPORT Parameters are below mentioned and Export parameter is Blank
                                                                                    Start Date (Mandatory field)
                                                                                    Partner Function (Mandatory)
                                                                                    Region
                                                                                    Customer
    Please let us know if required any information.
    Regards,
    Raghavendra

  • Data/Value from a function - passing it on to Crystal Report

    Post Author: helpwithcr
    CA Forum: General
    Could any of you give me an insight to this
    I have these functions with the values/data is residing in my Oracle package. How do I retrieve those to show the result on Crystal Report.?
    example-----
    function my_name
    return varchar2
    is
    begin
    return 'my name is this;
    end my_name;
    This is residing in my oracle package..... i would like to know whether I can get this data on my crystal report using the web/ CR way ???
    Thanks,
    helpwithcr

    Post Author: helpwithcr
    CA Forum: General
    Type my_table is table of varchar2(25);function my_phone_numbers return package.my_table;function my_phone_numbers return package.my_tableismt package.my_table:= package.my_table('0000-000-0000','111-111-1111');beginreturn mt;end my_phone_numbers;
    I should be able to get the output, but dont think i can get the out put just by using simple sql
    but how will I get this one on to crystal report. That is the main issue
    thanks
    help

  • Questions on the functionality of Crystal Reports 2011

    Dear all ,
    i recently got in contact with Cyrstal Reports and have to conduct an analysis about its functionalities and possibilites.
    I have some questions which could not be answered using internet research and would be very happy if some of you (who are certainly more experienced) could give me some short answers on them.
    1. I know that you need SAP NetWeaver in order to run Business Objects Analyits for MS Offic, but do i need the NetWeaver application also for Cyrstal Reports (CR) ? In my case I have an Oracle database and have not the possibility to change to a Netweaver data warehouse
    2. I have a PPT Master document (with predefined action titles, headings etc.). Is it possible to create my charts with CR and then automatically integrate them in my Powerpoint Master? I know that CR can create .png (and other) but I want that the user can change the diagram in powerpoint (e.g. changing colours)
    Is that possible ?
    3. When having a direct connection to Powerpoint, is there a way that i can identify updated graphics ? I´m thinking of some kind of red dot that symbolized users that this graphic has changed.
    4. Is there a way to integrate CR directly in PPT that users have the possibility to create reports in PPT or do I always have to use the CR interface?
    Would be very happy if you just could give me some brief answers on the questions cause I have not much experience in the field (as my questions already indicate Wink )
    Thanks and Greetings,
    Dan

    Good afternoon.  I have attempted to address your questions below.  Please review my answers and let me know if you need more details.
    Regards,
    Coy
    Product Manager - SAP Crystal Reports
    1. I know that you need SAP NetWeaver in order to run Business Objects Analyits for MS Offic, but do i need the NetWeaver application also for Cyrstal Reports (CR) ? In my case I have an Oracle database and have not the possibility to change to a Netweaver data warehouse
    Crystal Reports does not require SAP NetWeaver in order to function. In fact, Crystal Reports is a desktop tool used to create reports. You can then publish those reports to the SAP BusinessObjects BI Platform, embed them in custom applications, or view them directly via a desktop viewer (or in another format).
    2. I have a PPT Master document (with predefined action titles, headings etc.). Is it possible to create my charts with CR and then automatically integrate them in my Powerpoint Master? I know that CR can create .png (and other) but I want that the user can change the diagram in powerpoint (e.g. changing colours)
    Is that possible ?
    It is possible to integrate Crystal Reports content directly into Microsoft Office documents by using the SAP BusinessObjects LiveOffice tool.
    3. When having a direct connection to Powerpoint, is there a way that i can identify updated graphics ? I´m thinking of some kind of red dot that symbolized users that this graphic has changed.
    This is not possible "out of the box", but may be possible via some custom addon.
    4. Is there a way to integrate CR directly in PPT that users have the possibility to create reports in PPT or do I always have to use the CR interface?
    Please see the answer above for #2.
    Edited by: Coy Yonce on Jul 25, 2011 11:01 PM
    Edited by: Coy Yonce on Jul 25, 2011 11:02 PM

  • Crystal Report Connectivity to Function module

    Hi,
    I have a crystal report which is connected to a Function module in ECC(dev). After the function module moved to Quality I could repoint the crystal database to Quality. Later, some changes were made in the function module fields (eg: change in field length etc) by the field names were kept same. now when i try to repoint the database it says field not found and the report canvas becomes blank. but I can see the fields in the field explorer.
    is there a way to correct the error?
    Thanks, Arka

    Hi Arka,
    When you open the report then log into the DB and then click on Database, Verify Database. This should update the database info and changes in the report. CR keeps track of the DB it's connecting to so if you make s changes you must Verify the database to update the info in the RPT file also. Be sure to save the report.
    Don

  • Crystal Reports for VS2010 using a custom SAP ABAP function module data source

    I recently worked with Crystal Reports 2011 and was able to connect and retrieve data from our R/3 system via an ABAP function module. While researching other features, I found this version that can be installed into Visual Studio 2010. The parameters are not very user friendly in Crystal Reports so I was hoping to create a custom dialog to collect my report parameters.
    Does anyone know if I were to install Crystal Reports for Visual Studio 2010, would I be able to design a front-end selection screen in a Visual Basic form and then pass the input to through the Crystal Reports connection to my ABAP function module to retrieve the data filtered on the back-end by the selection screen parameters and return the results to be reported in the Crystal Reports output?
    I am using Visual Studio 2010 Professional Visual Basic with the .NET Framework 4.0 on 32-bit Windows 7. I was able to connect to our R/3 system in Crystal Reports 2011, so if I were to install Crystal Reports for VS2010, would there be a similar way of connecting to SAP?
    Any assistance or direction would be greatly appreciated.
    Thanks,
    Bryan

    Hello Bryan
    I don't know for sure, but I doubt this will work in CRVS2010. Only hope is that the utility available for download in this KBA will point you in the right direction.
    - Ludek
    Follow us on Twitter
    Got Enhancement ideas? Try the SAP Idea Place
    Share Your Knowledge in SCN Topic Spaces

Maybe you are looking for

  • Nokia's Warranty!!!

    Hi, Does anyone know what is Nokia's policy when it comes to Warranty on repaired Phones, i.e...how many times does the phone need to be returned/repaired to/by Nokia before they even consider replacing the Phone and/or giving the money back???

  • Turn maximum memory available/user in Solaris OS

    As part of the operating system turning for weblogic performance, how to check and turn the maximum memory available for a user process for Sun Solaris 2.6? Thanks in advance.

  • VS 2012 Deployment Issues

    One of VS2012's flaws is its limited deployment options out-of-the-box. There are many situations, where Click-once just isn't suitable. OK, so we have to use third party options: WIX XML to the rescue. But that is where problems start: So you have a

  • Elements Organizer Menu Off Screen Mac OS X

    Photoshop elements organizer was loading and I was changing the size of the window.  The program was kind of freezing and the top of the window got dragged off screen.  Nothing I have tried has gotten the window to its regular size.  I have tried cha

  • Does the Panasonic AG-HMC150 AVCHD work well with FCE?

    My buying finger is poised over the "send" button so that I can buy a Panasonic AG-AMC150 AVCHD camcorder, but I read a couple of reviews which have given me pause. One says that FCE does not work well with this camcorder and I need a REaLLY powerful