Using sql expressions in interfaces

Hi All,
I have created an interface that works very fine when used with constants.
But when i am using a sql case expression for populating a target column, the target column value is updated as null.
The expression that i have written is:
CASE WHEN (TEMP.CTRY_CODE = 'A012' ) THEN 'NEWCASTLE' ELSE 'GATESHEAD' END
This code works fine in sql developer but when written in odi intergrator, it is failing.
Please help.
Thanks.

Can use maybe a DECODE:
DECODE(DATA,'ASXXX','NEWCASTLE','SOMETHING')
Allcxz ...

Similar Messages

  • Using sql expression in filter

    Hi Experts,
    I have a question using 'sql expression' in filters in answers. Let's say i have a date filter and i would like the value for that date as max(tablename.colname). Please tell me the syntax for passing this.
    One more question is i have a date prompt the data will be refreshed weekly let's say the data refreshed like this *08/1/11 ,08/8/11 and 08/15/11* . Now if i select 08/08/11 it will show the data
    populated on *08/08/11* which is ok but if i select *08/09/11 to 08/14/11* it show only *08/08/11* data. Same way if select *08/16/11 or 09/16/11* it should show the last refreshed data which is *08/15/11*
    Thanks in Advance.
    chak

    Ok, so you want the report to be restricted as of last refresh date when your selects a date in prompt which is beyond/greater than the last refresh date.
    One way of doing this can be as below:
    - Capture the last refresh date in a repository variable. So this variable will always hold a value for last refresh date.
    - In prompts, capture the date selected by user in a presentation variable and apply the below statement in the Advanced SQL of the report.
    DateColumn = case when Timestamp '@{pvar}{2011-01-01 00:00:00}' <= valueof("lastRefDate") then timestamp '@{pvar}{2011-01-01 00:00:00}' else valueof("lastRefDate") end
    Here pvar is your presentation var and lastRefDate is your rep variable holding the last refresh date. What this statement would do is if user selects a date which is less that equal to last refresh date, then report will be filtered as of that date. Else, the report will be filtered by value of the Last Refresh date.
    Thanks

  • Syntax Error when using SQL Expression

    Morning all,
    When I try to type any SQL Expression within Crystal I am getting syntax errors, even when I type only SELECT {field name} FROM {table name}.
    Here is the query I did which gave me the following error:
    Query
    SELECT  order_progress . date_created
    FROM order_progress
    WHERE  order_progress . order_no = order_header . order_no
    AND  order_progress . order_status =77
    ORDER BY  order_progress . date_created DESC
    Error
    Error in compiliing SQL Expression
    Database connector Error: 'HY000[Informix] [Informix ODBC Driver]General Error. Syntax Error[Database Vendor Code-11060]'.
    Now this means, 1: I am getting a connection error with my db, for no apperent reason. 2: my syntax is not approved?!
    Can someone explain why is this happening and how to resolve this?
    many thanks
    Kind Regards
    Jehanzeb

    Morning Kyle,
    Thanks for the informative answer, I have found out the formula which counts number of days however, I am not sure what you meant by the following:
    >
    Kyle McAdam wrote:
    > create a formula that does the datediff....this will be a group.
    Done this, it counts the working days as in weekdays and takes bank holidays out as well
    here is the formula:
    WhileReadingRecords;
    //{order_progress.order_status}= 77;
    //{order_header.order_status}>=77;
    Local DateVar Start := {order_header.date_entered};   // Starting Date
    Local DateVar End := {order_header.act_despatch};  // Ending Date
    Local NumberVar Weeks;
    Local NumberVar Days;
    Local Numbervar Hol;
    DateVar Array Holidays;
    Weeks:= (Truncate (End - dayofWeek(End) + 1
    - (Start - dayofWeek(Start) + 1)) /7 ) * 5;
    Days := DayOfWeek(End) - DayOfWeek(Start) + 1 +
    (if DayOfWeek(Start) = 1 then -1 else 0)  +
    (if DayOfWeek(End) = 7 then -1 else 0);  
    Local NumberVar i;
    For i := 1 to Count (Holidays)
    do (if DayOfWeek ( Holidays<i>) in 2 to 6 and
      Holidays<i> in start to end then Hol:=Hol+1 );
    Weeks + Days - Hol;
    You will then have a formula field that is evaluated to 1, if the status is 77.
    you mean second formula? How I used,
    If Order_header.Order_Status=77 then
    1
    else
    2;
    however this doesn't seem to be working.
    > Now, sum that formula in each group footer. Suppress the detail lines...
    which formula to sum up?
    > **Don't use a cross tab with this solution. For a cross tab, you would have to calculate the totals in a different manner.
    so far I used Cross tab and it is showing the right days, however not showing the correct jobs per day.
    You might be right there that it calculates the totals differently, additionally how am I suppose to get the right Percentage if using the Cross tab. The percentage should be, count of number of jobs % Total jobs.
    hence:
    {#NumofJobs} % {#Total_Jobs}
    however, when I create this formula it does not let me add that into the cross tab.
    I also need to put a subreport in my report, can I use Crosstab to contain a link to my subreport?
    Many thanks
    Kind Regards
    Jehanzeb

  • Extract Data Using SQL Expression

    Hello, I've created a staging table and just realized that I need some new extra fields.
    Should I create them in the stage or in the target table?
    I want to use the SQL expression COUNT so to fill these new fields with edited source data,
    but don't know exactly how to do it. I am a bit amateur.
    Thank you.

    I' ve just realized that I am reading your book! Oracle Warehouse Builder 11gR2: Getting Started 2011.
    What If I need the rest of the fields not to be changed? Fields like Name or whatever.I can't figure it out. Thanks again.
    For example, I have these two fields Name and Date and I want to use the count expression through the aggregation operator for the Date field and create a new field Quantity to store the reaults. But I need the field Name to remain intact.
    How can I manage this? Thank you.
    Edited by: 928543 on 11 Ιαν 2013 1:35 μμ
    Edited by: 928543 on 11 Ιαν 2013 1:44 μμ

  • Using SQL Express with Legacy PB

    I have inherited a legacy system written in PowerBuilder which connects to an SQL Anywhere 5.5 database via ODBC. The Sybase drivers are not 64-Bit compatible so this system is throwing errors and there are no updated drivers available.  I do not currently
    have the budget to update the database to a current version of SQL Anywhere (which required /seat license) and I'm under the gun to get the system working on a 64-Bit PC.
    Advice, please!  Is MS SQL Express a good option?
    Thanks in advance.

    Hello,
    Microsoft has created the following technical document for migrating from Sybase Anywhere (ASA) to SQL Server 2008:
    http://download.microsoft.com/download/7/C/2/7C20B070-BFF8-44B4-BD7D-1B03DF50F924/MigrateSybaseASAtoSQLServer2008.docx
    Microsoft offers the SSMA for Sybase Tool to migrate from Sybase ASE to SQL Server too, but it is not clear to me it supports Sybase
    Anywhere (ASA). The following third party tool seems to offer migrating ASA objects and data to SQL Server.
    http://www.ispirer.com/products/sybase-to-sql-server-migration
    However, I don’t have any suggestions for you about the PowerBuilder application.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Filtering "created on" date using SQL Expressions

    Hi there!
    I want to build a filter for opportunities "created on" date.
    I need to find all opportunities that were created over 30 days ago in lead stage.
    I was trying:
    Created on date is Not equal to or is not in:
    1) NOW()
    2) TimeStampAdd(SQL_TSI_DAY,-30,CURRENT_DATE NOW())
    I keep getting an error message.
    Any help is appreciated.

    I am in the historical opp area, here is the error:
    Error getting drill information: SELECT Opportunity."Sales Method Name" saw_0, Territory."Territory Name" saw_1, Opportunity."Sales Stage" saw_2, Opportunity.Name saw_3, Opportunity."Opportunity ID" saw_4, Account."Account Name" saw_5, Account."Account ID" saw_6, Opportunity."Created Date" saw_7, "- Opportunity Custom Attributes".DATE_26 saw_8 FROM "Opportunity Lists" WHERE (Territory."Territory Name" IN ('AC - Mid-Atlantic', 'AC - North Central', 'AC - Northeast', 'AC - Ohio Valley', 'AC - South', 'AC - South Central', 'AC - Southeast', 'AC - Southwest', 'AC - Western', 'Acute Care Sales')) AND (Opportunity."Created Date" <> TimeStampDiff(SQL_TSI_DAY,Opportunity."Created date", VALUEOF(NQ_SESSION.CURRENT_DT)) <= 30) AND (Opportunity."Sales Stage" = 'Lead')
    Error Details
    Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <<=>: Syntax error [nQSError: 26012] . (HY000)
    SQL Issued: {call NQSGetLevelDrillability('SELECT Opportunity."Sales Method Name" saw_0, Territory."Territory Name" saw_1, Opportunity."Sales Stage" saw_2, Opportunity.Name saw_3, Opportunity."Opportunity ID" saw_4, Account."Account Name" saw_5, Account."Account ID" saw_6, Opportunity."Created Date" saw_7, "- Opportunity Custom Attributes".DATE_26 saw_8 FROM "Opportunity Lists" WHERE (Territory."Territory Name" IN (''AC - Mid-Atlantic'', ''AC - North Central'', ''AC - Northeast'', ''AC - Ohio Valley'', ''AC - South'', ''AC - South Central'', ''AC - Southeast'', ''AC - Southwest'', ''AC - Western'', ''Acute Care Sales'')) AND (Opportunity."Created Date" <> TimeStampDiff(SQL_TSI_DAY,Opportunity."Created date", VALUEOF(NQ_SESSION.CURRENT_DT)) <= 30) AND (Opportunity."Sales Stage" = ''Lead'')')}

  • Error using Filter with SQL Expression

    Hey all -
    New to Oracle BI, and getting a problem with Filters that use SQL Expressions.
    The column I'm filtering on is a 4 digit year, expressed as a VARCHAR2(4 byte) in the physical database. My SQL Expression in the filter is:
    Column: CAL YEAR 4 DIGIT
    Operator: Is equal to/in
    SQL Expression: TO_CHAR(ADD_MONTHS(SYSDATE, -24), 'YYYY'))
    when I click on the "Results" Tab I get the following error message:
    Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <(>: Syntax error [nQSError: 26012] . (HY000)
    I've isolated the issue to the expression above. If I put in a literal value and supply a four digit year like below it works:
    Column: CAL YEAR 4 DIGIT
    Operator: Is equal to/in
    SQL Expression: *2008*
    Any ideas on what's causing my problem?
    Thanks!
    Mac

    macearl wrote:
    SQL View does not display unless data is returned by the query. Is that normal?
    Also, none of these options shows the literal result of the expression we built, i.e.:
    expression: CAST(YEAR(TIMESTAMPADD(SQL_TSI_MONTH, -24, CURRENT_DATE)) as CHAR)
    result: *2008*
    Having the ability to test expressions and see their results would be very helpful in debugging. If anyone knows how to do that please share!
    Thanks!
    MacOk, Probably shoud have figured this out before, but in response to my own question, the way to view the result of an expression is to add the expression as a column and include it in the Table Presentation.
    - Mac (he can be taught)

  • How can I Purge in SQL Express database?

    For development purposes, we created a Hyper-V VM running Windows 7 with BizTalk Server 2010 installed running against a SQL Express database. We also installed Visual Studio (licensed) for map development.
    Over time, the BizTalk tables grow, and are taking up way too much storage space.
    I looked at the "Microsoft recommended" method of purging the BizTalk database/tables, but it requires enabling a DTA job in SQL Agent which is not available in SQL Express (as far as I know.)
    How can I purge the BizTalk tables in SQL Express to reclaim storage space?
    Since this is a development platform, I do NOT care about ANY historical data being retained, only "system" data (such as parties, etc.)
    Thanks!!
    Jim Barr

    You can use the various cleanup scripts to purge the database.  Details:
    http://biztalkscheduledtask.codeplex.com/
    Of course, you should not be using SQL Express.

  • SQL Expression fields do not display when no records are returned

    I have a report that uses SQl expression fields to summarize in the Report footer.  When the main report does not contain any records the SQL expression fields are blank.
    Is there a way to force these SQL expression fields to be evaluated evn when the main report does not contain any records.
    Thanks

    Hi,
    You can try this :
    Under Report Options, check "Convert Database Null values to Default".

  • Install SQL Express With MDT 2012 now or wait for SCCM and full SQL Server?

    We are planning to get SCCM 2012 R2 in several months and it will come with SQL Server 2012 when it is installed and configured at that time.
    If we would like to start experimenting with using a database in MDT 2012 now, can we go ahead and set up a database in SQL Express and start using it  for deployments now or should we wait for SQL server?  
    Can the database created in standalone MDT 2012 with SQL Express be migrated to SQL Server 2012  and SCCM 2012R2 or would we need to start over with a new database when we get SQL Server and SCCM?

    Using SQL Express should be fine.  You can export the database from there and import it into a full SQL Server install later if you want to preserve the content.
    Thanks,
    -Michael Niehaus
    Senior Product Marketing Manager, Windows Deployment
    http://blogs.technet.com/mniehaus
    [email protected]

  • SQL Expression Fields not showing

    Hello,
    I want to use "SQL Expression Fields", however, it doesn't appear in the Field Explorer.
    The only options that appear in my Field Explorer are:
    - Database Fields
    - Formula Fields
    - Parameter Fields
    - Running Total Fields
    - Group Name Fields
    - Special Fields
    I am connecting to Oracle 10g Rel.2 with ODBC.
    I have no problems creating reports with queries that access the database.
    Do you have any idea about why the option doesn't appear?
    Cesar

    Post Author: synapsevampire
    CA Forum: Data Connectivity and SQL
    V361 is mistaken, SQL Expression fields are available in CRXI.
    As with previous versions though, it turns off depending upon the type of database and connectivity used.
    Try using a real SQL database, or if MS Access, set up an ODBC connection to the database.
    In the future include your database in your post to avoid guess work on our part.
    -k

  • Reference in SQL Expression to a group key

    Hello to everybody, i am working with a report in Crystal Report 11 and i need some help.
    In the design of my report i have two groups corresponding to a table which has two keys. The first one belongs to an Id and the second to a datetime.
    The fact is that i have to filter second group with a specific date that i have to obtain with a sql query. So i was thinking in using SQL Expression but i cant make it the right way because i cant filter in the where condition with the id of the superior group. I dont know how to write the where condition.
    If anyone can help me i will be grateful.
    Thanks.

    Thank you Sastry for responding so quickly.
    I think you dont understand me. I have this:
    -Group 1: id
             -Grupo 2: datetime
    the field datetime i need to filter with a specific date. In order to be clear the SQL Expression i made to filter this datetime is:
    (select max(datetime) from Table1)
    That maximum datetime i need it be for each id in the Group 1 (so the sql expression is not a single value, its a single value for each id of Group1), but i can't put this in the sql expression:
    (select max(datetime) from Table1 where Table1.id = Group1.id)
    and then the other problem is how to filter the datetime in group 2 with the value of the SQL Expression
    PD: Where is the option add command in crystal report?

  • SQL Expressions, commands and more

    Hello:
    I have several reports I need to create in Crystal Reports XI, and I'm not sure of the best methodology.  I have an ASA (Adaptive Server Anywhere) 9.02 database that I am connecting to through ODBC.  The main part of the query is fairly straightforward, but the WHERE clause, I believe, forces me to use a command object.  My query, cut down for sanity's sake, is as follows:
    SELECT bridge.brkey,  
             bridge.bridge_id,
             bridge.struct_num,
             inspevnt.suff_rate,
             inspevnt.nbi_rating,  
             bridge.fips_state,  
             bridge.facility,  
             bridge.location,  
             roadway.on_under
    FROM  bridge,  
             roadway,  
             inspevnt 
    WHERE
              ( bridge.brkey = :as_brkey )  and
              (( ( roadway.brkey = bridge.brkey ) and 
             ( inspevnt.brkey = bridge.brkey ) and 
             ( inspevnt.inspkey = (select max(i.inspkey) from inspevnt i where
                        i.brkey = bridge.brkey and i.inspdate = (select max(j.inspdate) from
                inspevnt j where j.brkey = bridge.brkey))) and
             ( roadway.on_under = (select min(r.on_under) from roadway r where
                        roadway.brkey = r.brkey )) ))
    That's the query as it is used on an old Sybase DW.NET report, which  I have to make work in Crystal.  I am able to use the command object and make it work (is this the best way?), but that makes it so I can't use SQL Expressions in the report, which I think I need to solve my other problem as described below.
    The field "bridge.fips_state" is actually a code such as "06" or "12" that refers to data in an as yet unreferenced table names PARAMTRS.  The PARAMTRS table replaces all of the possible individual lookup tables, and has columns that contain a field for the table name, the field name and the parameter value.  For example, if I have the value "06" in my current record, I need to query from the PARAMTRS table to find out what "06" means for the "bridge" table and the "fips_state" column.  The SQL code for that is as follows:
    SELECT paramtrs.shortdesc FROM paramtrs
    WHERE paramtrs.table_name='bridge' and paramtrs.field_name='fips_state' and paramvalue='06'
    This returns the value in the shortdesc field, "06 California" which is what the users want on their report instead of the value "06" from the bridge table.  If my WHERE statement in the first query forces the use of a command, and negates my abilty to use SQL Expressions, how can I extract values from my PARAMTRS table, which I need to do for several fields in the main query.
    Does anyone have any advice on this?
    Thanks.

    Scott,
    A SQL Command is probably the best way to go. While it's true that you can't use SQL Expressions in conjunction with Commands, you don't need to.
    Just add whatever you would add whatever you would put in the Expression, to the SQL Command.
    For example, just add the PARAMTRS table to the existing SQL script in the FROM clause, link it in your WHERE clause and then add whatever fields you need from that table under the SELECT statement.
    Use the SQL Command...
    Jason

  • SQL Expressions in Declarative SQL mode VOs - possible?

    Hi all,
    I am planning to create a declarative SQL mode VO and am wondering if I would be able to use SQL expressions on the select clause - for ex- SUBSTR(col1,1,10). Is this possible?
    I searched around and could find no reference.
    Thanks,
    Srini

    Srini, @chris hope you don't mind me stepping in
    Just checked this in 11.1.1.4.0 and 11.1.1.6.0 and it worked for me.
    I used the HR schema and the Departments table
      <ViewAttribute
        Name="DepartmentName"
        IsNotNull="true"
        PrecisionRule="true"
        EntityAttrName="DepartmentName"
        EntityUsage="Departments"
        AliasName="DEPARTMENT_NAME"/>
      <ViewAttribute
        Name="nnn"
        IsPersistent="false"
        PrecisionRule="true"
        Precision="255"
        Type="java.lang.String"
        ColumnType="VARCHAR2"
        AliasName="VIEW_ATTR"
        Passivate="true"
        Expression="SUBSTR(DEPARTMENT_NAME, 1, 5)"
        SQLType="VARCHAR"/>
    ...The nnn attribute I added to show only the first 5 characters of the department name.
    Timo

  • SQL Express HA configuration

    Hi ,
    i want to configuration SQL DB high availability using sql express 2008 r edition without domain environment .
    As far as I know express edition have limited features and come to know that only merge replication available .
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/f6f20183-23f3-4369-b3c8-7092acf09ad3/configure-sql-express-to-utilize-windows-clustering?forum=sqlexpress
    http://social.technet.microsoft.com/Forums/sqlserver/en-US/ecee4597-772b-45cc-beda-f8fbe3de10e1/multi-sql-express-for-ha-and-performance?forum=sqlexpress
    please let me know if I can do this with using two workgroup pc ( windows 2008 server ) if yes what best practice have to follow.
    Don't forget to mark helpful or answer
    connect me :-
    http://in.linkedin.com/in/satya11
    http://facebook.com/satya.1000

    Before thinking about high availability, you need to define your availability requirements (recovery point and recovery time objective.) This should dictate the solution that you will have to implement. If your availability requirements are mission-critical,
    I don't think using SQL Server Express Edition would be the right choice to make.
    Edwin Sarmiento SQL Server MVP | Microsoft Certified Master
    Blog |
    Twitter | LinkedIn
    SQL Server High Availability and Disaster Recover Deep Dive Course

Maybe you are looking for