Cast 3 Concatenated Fields as Date

Hi,
I have the following requirement. On the contact page there is a drop down field named Starting month of months (Jan to Dec). On the report i need to show Starting Date column, which is a concatenated field of 01 as date, Value in the Starting month field and current year.
For Ex: If user select Feb , on the report in Starting Date column it should display 01-Feb-2011. This can be achieved using combination of concat functions. But i also need another column to show if starting date is passed or not based on Starting Date coulumn and current date. To do that i need to cast the concatenated field (i.e Starting month) to Date.
But when i try to cast starting date as DATE, i get a error message. The sample cast function i have used is "CAST(REPLACE(CAST(YEAR(CURRENT_DATE) AS CHARACTER) ||'-'|| CASE WHEN Contact.PICK_10='Jan' THEN '01' ELSE Contact.PICK_10 END || '-' || '01', ' ', '') AS DATE)" .
Does anyone knows how to cast strings as Date? Any workarounds on this issue is appreciated.
Thanks in advance.

Mark, you are not alone.
We also encountered this error using XI 3.0.  We received the "Driver is not capable" error message when including date dimensions from a universe built on a BEx query.  Looking at the universe, the date dimensions themselves were date fields, but all the date keys were listed as characters.
Our fix:
Replace all the date dimensions with the date keys listed below the dimensions.  This is a little tricky because when you add the key into your webi query, it automatically adds the dimension.  You have to manually remove the dimensions from the webi query after adding the key, and your report should run without the "Driver not capable" error message.
This is a serious bug, because now we have to train users building the webi queries to delete the date dimension.  We cannot hide the dimension in the universe because it will also hide the key.
I guess another fix could be creating a new Dimension in the universe, and copying the properties from the key field into the new dimension...but if you have many dates, it's a big pain.
Hope this helps,
-Lee

Similar Messages

  • Cast string in a text field as date in UK format on reports

    Hi All,
    I have UK locale setup for all my users, so all date / time fields display in dd/mm/yyyy hh:mm:ss format. However this one field is a text field and has a timestamp value in it in US format like 05/26/2011 16:31:00 and I am trying to display it like 26/05/2011 16:31:00 in reports.
    I tried to Cast it as DATE or TIME or TIMESTAMP it errors out saying invalid month. Understandable.
    The best I have managed to do is to simply use the SUBSTRING, LEFT and RIGHT functions as below and rearrange the characters to display it the way I want, but I don't want to hard code it that way. There are a few US locale users as well and it will impact them if I hard code it.
    SUBSTRING ("- Service Request Custom Attributes".TEXT_35 FROM 4 FOR 3) || LEFT("- Service Request Custom Attributes".TEXT_35, 3) || RIGHT("- Service Request Custom Attributes".TEXT_35, 13)
    Is there a way to achieve this? Please suggest. The reason I am doing it is in the same report there are other date / time fields displaying in UK format except this one so it's confusing to users.
    Regards,
    Udaya

    The reason you're receiving the "Invalid Month" error is that the date format expected by the cast function is dd-mmm-yyyy (as in: 11-Jun-2011). You can use substring and case statements to pull out what you need from the data field, and then cast it to an actual date.
    Chris

  • Crystal 2013 is casting a function with a date result as a string result, sometimes??

    I have an SQL Server function to take a JDEdwards numeric date and convert it to an SQL Date field. 
    CREATE FUNCTION [dbo].[date_ccyyddd_to_mmddyyyy]
      @JulianDate as Numeric(18,0)
    RETURNS Date
    AS
    BEGIN
    Declare @ResultDate as Date
    Set @ResultDate = DATEADD(YEAR, @JulianDate / 1000 + 1899, Cast('01/01/0001' as Date))
    Set @ResultDate = DATEADD(Day, @JulianDate % 1000 -1, @ResultDate)
    RETURN @ResultDate
    END
    In many query based reports we have used the function.  It works quite nicely for all but one user.  For this one user Crystal is casting the date result as a string, it will then display as a yyyy-mm-dd format instead of his default mm/dd/yyyy short date format.  It would generally be ok but since it is typed as a string if the user exports the results to excel it is not recognizing the column as a date either.  The strange piece of the equation is that if the user saves the report to the enterprise server and I open it, go to edit the SQL command, do nothing, close the edit box, it gives me the unmapped fields wizard where I can fix the report.  Thus when I open or generate a new report with this function it "knows" the result is a date but with a specific user it sees the result as a string.
    Has anyone had a similar situation or can lead me in the correct direction to fix this?  Unfortunately, this user is our power user, he writes more reports than anyone else.  It appeared as a problem when we upgraded from Crystal Enterprise 2008 to 2013.
    Current work around for user is to use a crystal CDate() function on the report side but I would like to get the correct solution.
    Any assistance appreciated,

    To add to Dell's suggestion:
    If OLE DB then use:
    MS SQL 2005 - OLE DB Provider
    MS SQL 2008 - SQL Native 10
    MS SQL 2012 - SQL Native 11
    MS SQL 2013 - SQL Native 11
    If ODBC then use:
    MS SQL 2005 - SQL Native
    MS SQL 2008 - SQL Native 10
    MS SQL 2012 - SQL Native 11
    MS SQL 2013 - SQL Native 11
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • (Class cast Exception)Problem while loading data fro database in java class

    Dear all,
    Please help me...to solve this
    I have a database having two columns of String and Date Types.
    In my java code i was trying to load the data to a UI.
    I am successfull in loading the String type value.
    But while loading date field value,is showing Class cast Exception.
    What i am doing is Getting the values from database to a String[] array.
    So my question is how to
    get the Date field as date field itself,Then convert it to a String..Then put it in to String[] array...
    Any body please help...If any one want more clarification in question i will give......

    Hi,
    I am using GWT to display my data in a Grid.
    So it will accept a Single two dimensional String array....Here i have one as String and other as Date.
    So i was trying to get each row in a sindle dimensional array array[] then store it in a list.
    Iteration goes up to 10 rows.After i am setting it in to a list
    ie list.add(array);
    Now while returning this list i am doing this
    "return (String[][])list.toArray(new String[0][]);"
    When i tried to get the date element to String array it is showing class cast exception. When i tried with toString() method it is showing the same problem.

  • Converting varchar field to date

    I got a varchar field in DB with format YYYY/MM/DD HH:MI:SS in DB . I want to convert this to date field in RPD. When I did
    CAST ( VarChar field AS DATE) in RPD it is not working I am getting sql error.
    Thanks for your help.

    Hi,
    can you try once to cast your char as a timestamp.
    Hope that works.
    Kr,
    A

  • Speeding up a query on a concatenated field.

    Hi,
    I have a view with a concatenated field that basically comes down on this:
    ALTER VIEW [dbo].[_FO_QP_Items_4_0] AS
    SELECT
    Col A ,Col B --etc
    ,CONVERT(nvarchar(36), sysguid) +'|'+crdnr AS [LevCode]
    FROM table A
    As you see I am concatenating 2 fields together to get a unique [LevCode] (concatenating Itemcode + Supplier code)
    If I query that view like this, it runs rather slow on a 500.000+ rows table:
    SELECT *
    FROM [dbo].[_FO_QP_Items_4_0]
    WHERE [LevCode] = 'DF007704-38EF-4389-8544-E70CC32404D5| 60102'
    ORDER BY Col A
    Unfortunately I am not able to add an extra column to the table and concatenate the fields there. 
    Is there a way to speed up the query (or view).
    Thanks for helping me out here.

    Index view has high overhead. It has to be really justified.
    BOL: "Indexed views work best when the underlying data is infrequently updated. The maintenance of an indexed view can be greater than the cost of maintaining a table index. If the underlying data is updated frequently, the cost of maintaining the indexed
    view data may outweigh the performance benefits of using the indexed view. If the underlying data is updated periodically in batches but treated primarily as read-only between updates, consider dropping any indexed views before updating, and rebuilding them
    afterward. Doing this may improve performance of the updates."
    Reference:
    https://technet.microsoft.com/en-us/library/ms187864%28v=sql.105%29.aspx?f=255&MSPPError=-2147217396
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • How to display concatenated fields

    hi all,
    i have two fields which i have concatenate.The query for concatenated is this:
    data: N1 like LFA1-stcd2,
          N2 LIKE LFA1-stcd1,
          N3 TYPE C,
          SEP(3) TYPE C VALUE ':'.
    *CONCATENATE N1 N2 INTO N3.
    *WRITE N3.
    *CONCATENATE N1 N2 INTO N3 SEPARATED BY SEP.
    *WRITE / N3.
    Now i have to display in my Perfrom display_report.So i have written this code.
    PERFORM fill_fieldcat USING 'N3'  10  'Taxpayer Id' 'GI_MAIN'.
    GI_MAIN i already define N3 but when i execute it gives me null values.
    Thanks

    If n1 and n2 have values assigned and n3 is of type string, than it works. For example like this:
    DATA: n1 LIKE lfa1-stcd2 value '123',
               n2 LIKE lfa1-stcd1 value '678',
               n3 TYPE string,
               sep(3) TYPE c VALUE ':'.
    CONCATENATE n1 n2 INTO n3.
    WRITE / n3.
    CONCATENATE n1 n2 INTO n3 SEPARATED BY sep.
    WRITE / n3.

  • Converting float fields to date Time

    I have an application that stores datetimes into float fields, the data is formatted yyyymmddhhmmss or 20081122091030. I need to convert this data to a datetime data type so I can do datetime calculations (differences) for reporting purposes. It would be preferable to have the data formatted yyyy/mm/dd hh:mms. I have tried numerous methods with out success. As I understand it I need to CONVERT to a VARCHAR first.  I am new to TSQL & this one turning out to be a knotty problem so I would really appreciate anyone’s assistance,
    SELECT (
      LEFT(CAST(IS_DUE_DATE AS VARCHAR(14)),8) + ' ' +
        SUBSTRING(CAST(IS_DUE_DATE AS VARCHAR(14)),9,2) + ':' +
        SUBSTRING(CAST(IS_DUE_DATE AS VARCHAR(14)),11,2) + ':' +
        SUBSTRING(CAST(IS_DUE_DATE AS VARCHAR(14)),13,2))
    FROM  ISSUES
    However when I try to Covert to DATETIME it all goes pear shaped.

    Try this
    Code Snippet
    DECLARE @MyDate float
    SET @MyDate = 20090922112143997
    SELECT CONVERT(DATETIME,
    LEFT(CAST(CAST(@MyDate as BigInt) as varchar(20)),8)+' '+
    SUBSTRING(CAST(CAST(@MyDate as BigInt) as varchar(20)),9,2)+':'+
    SUBSTRING(CAST(CAST(@MyDate as BigInt) as varchar(20)),11,2)+':'+
    SUBSTRING(CAST(CAST(@MyDate as BigInt) as varchar(20)),13,2) + '.' +
    SUBSTRING(CAST(CAST(@MyDate as BigInt) as varchar(20)),15,3)
    Added using a temp table:
    Code Snippet
    CREATE TABLE #T
    fdate float
    go
    INSERT INTO #T VALUES (20090922112143997)
    INSERT INTO #T VALUES (20090921182143997)
    INSERT INTO #T VALUES (20090921012323997)
    SELECT CONVERT(DATETIME,
    LEFT(CAST(CAST(fdate as BigInt) as varchar(20)),8)+' '+
    SUBSTRING(CAST(CAST(fdate as BigInt) as varchar(20)),9,2)+':'+
    SUBSTRING(CAST(CAST(fdate as BigInt) as varchar(20)),11,2)+':'+
    SUBSTRING(CAST(CAST(fdate as BigInt) as varchar(20)),13,2) + '.' +
    SUBSTRING(CAST(CAST(fdate as BigInt) as varchar(20)),15,3)
    FROM #T
    DROP TABLE #T

  • DSO - What key fields and data fields in dso

    Hi experts,
    I need to create a dso in between the cube and 2 data sources(2lis_11_vaitm, 2lis_12_vcscl) to stage the data. My question is: what key fields and data fields to choose for the dso? is there a standard dso to copy? please explain in detail the model to set up, whether to connect both the ds's to dso and then to cube or one ds to dso and the other to the cube. more details will help.

    Check this for standard DSO:
    http://help.sap.com/saphelp_nw04/helpdata/en/43/fcdc387f34384f94c3227baf3837a8/content.htm
    Thanks...
    Shambhu

  • Data in one field requires data in another field

    I am trying to build a form that forces data entry (text)
    into a field if a previous ( or other ) field has data in it.
    Example: If there is data in the "Full Name" block, you have
    to put data in the "Crew Name" block.
    If the "Crew Name" block contains data, all is fine,
    otherwise an error message is created.
    Also, how do I validate this ( is it even required ? )
    Thanks ! ~The Noob~

    Droto wrote:
    > I am trying to build a form that forces data entry
    (text) into a field if a
    > previous ( or other ) field has data in it.
    > Example: If there is data in the "Full Name" block, you
    have to put data in
    > the "Crew Name" block.
    > If the "Crew Name" block contains data, all is fine,
    otherwise an error
    > message is created.
    > Also, how do I validate this ( is it even required ? )
    > Thanks ! ~The Noob~
    >
    Are you saying that "Full Name" is not required? But if there
    is data in
    the "Full Name" field, then "Crew Name" is required?
    Mick

  • Key fields and data fields in a DSO  ??

    i have a question regarding key fields and data fields in a Standard DSO...
    i am using 2 datasources to build a open sales report 2LIS_11_VASTH  and  2LIS_11_VASTI   i am pulling in data from these 2 data sources to a DSO and i am wondering what infoobjects should be in the key fields and data fields .....does this reflect back to table VBUK and VBUP tables and does the key field in the DSO have to be the key fields in VBUK and VBUP tables  ????  or what really should be included as key fields and data fields   ????  
    please help....

    If you look at the various SD tables, VBELN and POSNR are commonly used as the document number and document line item.
    For VBAP and VBUP, it's referring to the Sales Order Line Item with the columns VBELN and POSNR as the key for both tables. However, if you look at the LIPS table, which is the Delivery Line Item table, it too has VBELN and POSNR as the key. Likewise, the VTTP table, which is the Shipment Line Item table, also has VBELN and POSNR as the key.
    While using RSOSFIELDMAP as a map is a fairly good "rule of thumb", it still needs to be used with a level of skepticism.

  • Prerequsites for deciding Key fields and data fields

    Hi
    I would like to know the criteria to decide upon KEY fields and Data fields for an infoprovider.

    Hi,
    What is a Key field in a Database and How should I choose one?
    Keys are crucial to a table structure for many reasons, some of which are identified below:
    They ensure that each record in a table is precisely identified.
    They help establish and enforce various types of integrity.
    They serve to establish table relationships.
    Datafields may be Charecteristics and it may be keyfigures
    Regards,
    Marasa.

  • Chart report Condition fields and Data fields

    Hi all,
    i have tried chart report by adding two condion fields and one data field, the report is more meaning full in this scenario. the first condition field is taken as x-axis, the 2nd condition fields is taken as legend.
    while adding more condition fields and data fields, i feel its not showing meaningfull data.
    can anyone explain how the condition fields and data fileds are manipulated by crystal report.
    i am using CR XI R2 Server.
    Thanks
    Padmanaban V

    i am using Crystal Report XI R2 RAS Embedded in my server.
    as we can add any number condition fields programatically using the method
    ConditionField.Add(FieldObj), i would like to know how these fields are manipulated internally by the RAS server.
    that means, what is the significance of condition fieldobject 1, condition fieldobject 2,condition fieldobject 3 etc...
    if i add more than two condition fields , RAS Chart Report always returns 0 as legend value for all legends.
    Thanks in advance
    Regards,
    Padmanaban V
    Edited by: Padmanaban Viswanathan on Dec 22, 2008 9:53 AM

  • Releation between fields and data element

    Dear Abapers,
    What is the relation between the fields and data element,  while cretion of fields system will ask the data element, can we have one data element to more than one fields.  Can you plese explain me.
    Regards

    Hi,
    data elements are structures defined in SAP Dictionary. 
    Fields you meen in a table? or in programs? in both places you create in reference to SAP Dictionary. 
    data element char20.  TEXT20
    Programs  data:  l_text type char20.
    Tables  ... field   ZTEXT  type CHAR20...TEXT20

  • Identify key fields and data fields

    Hi
    i have datasource 0co_om_cca_9 .
    i want build 1 DSO, how can i identify what are key fields and data fields to build DSO based on that datasource.

    Hi sunnel,
    The DSO are like 2-D database tables.
    We use the technical keys here in counterpart to the business keys in Infocubes.
    The key fields are the one based on which the records are identified uniquely in the database table.
    And the data fields are the ones which are aggrgated or summarised or overwritten based on the value in key filed.
    For example:
    The ID no.s of the employees will be unique and it can be used as a key field.
    The feilds like the Salary taken by the employee every month :"SALARY"
    and the no. of leaves they taken: " NO. OF LEAVES" can be used as data fields.
    So that the salary or the leaves taken by a particular employee can be aggregated based on her/his ID no.
    The key fields in DSO doesnty mean Key figures.The key field means any unique key or a key based on which the records are sorted in the DSO
    And key figures are the data fields.Some of the Characteristics can also be data fields in DSO.
    Please give points if u r satisfied wit the information
    Also let me know if u hav any doubt and if any thing is wrong.
    Regards,
    Kalpana M

Maybe you are looking for