Expression Builder Question

I am trying to convert some existing sql to use TopLink ExpressionBuilder. I have a particular type of thing which I can't find a good solution for.
I want to include a calculation, so for example, I want to say
Where MY_COLUMN * 10 > REQUIRED_VALUE
The only way I've managed to do it so far is to use the appendSQL() method. This gives me a problem because this method is deprecated and I can't see what I should use instead. Secondly, I am using a column name in this bit of SQL, if I try to do it 'properly' and join the SQL with a get for my mapping item which maps to MY_COLUMN then add some more SQL it all falls to pieces. This means I have to 'hard code' my column name in the SQL which is not where I want to be.
Can you tell me if there is a proper way to generate calculations in sql expressions.

You can use the ExpressionMath class.
Expression expression = ExpressionMath.multiply(builder.get("myColumn"), 10).greaterThan(requiredValue);
The appendSQL() method was replaced by the prefixSQL() and postfixSQL() methods.

Similar Messages

  • Expression builder Syntax question

    In workflow, I want to send an email when a certain date field is populated.
    I want this action to execute only when the date is initially populated so I want to use PRE to check to see if the date field was blank before it was populated.
    would I check to see if the date field WAS blank by using the following syntax?
    (PRE('<dContract_Execution_Date_ITAG>') IS NULL)
    Or should I use
    (PRE('<dContract_Execution_Date_ITAG>') = "")

    Thank you I will try your suggestions. I tried the IS NOT NULL and I kept getting a syntax error. It was driving me nuts, because I was fairly certain it would work.
    This is a little off topic, but I've noticed when I enter an expression or copy paste it into expression builder I get a syntax error only to retype the expression (exactly as it was typed previously) and the system will except it. The only thing I can think of is maybe some sort of invisible character is picked up.
    This has happened to me numerous times when coding workflow rules. It tends to slow the design process.

  • Compare only DATE portion of a datetime field in Expression builder

    Hi! All,
    This may be a simple question, but I couldn't find the answer. I have a query where I want to say :
    Expression exp = exp1.get("startDateTime").equal(pDate);
    here pDate is a java.util.Date class with a time stamp.
    I wish to basically compare just the DATE portion of the value stored in the data base with only the DATE portion of "pDate" and ignore the time component.
    How do I do this in expression builder?
    By the way we are on Toplink 9.0.4.5
    Thanks

    There are a couple of ways to accomplish this. You could use between(beginningOfDay,endOfDay) where beginning of day is 12:00:00am on the date specified in pDate and end of day is 11:59:59pm on pDate. Or you could consider using a combination of dateName(), datePart(), and/or truncateDate() expressions to compare at the day, month, year level. I am not sure which would give you better performance, so you might need to do some testing to verify.
    In the first case, create beginningOfDay and endOfDay based upon the date housed in pDate. Then:
    Expression selectionCriteria = exp1.get("startDateTime").between(beginningOfDay,endOfDay);
    In the second case, there would be a little more code to write:
    Expression startDateTimeExp = exp1.get("startDateTime");
    Expression dayExp = startDateTimeExp.datePart("day");
    Expression monthExp = startDateTimeExp.datePart("month");
    Expression yearExp = startDateTimeExp.datePart("year");
    int desiredDay = get day of month from pDate;
    int desiredMonth = get month of year from pDate;
    int desiredYear = get year from pDate;
    Expression selectionCriteria = dayExp.equal(desiredDay).and(monthExp.equal(desiredMonth)).and(yearExp.equal(desiredYear));
    Check out the TopLink API docs on the Expression class for more details on what these Expression building methods do : http://download-west.oracle.com/docs/cd/B10464_05/web.904/b10491/index.html
    Hope that helps,
    Doug

  • Custom XPath function & customize XPath expression builder

    Hi,
    I have made several custom XPath functions and apparently it is not possible to customize the UI and add these functions to the XPath expression builder.
    Could someone confirm this ?
    Thanks

    Nobody knows the answer?
    I just have the same question.

  • Expression builder

    i want to use if function in expession builde .
    iig(month( @[User::edate) ==2 and year(@[User::edate) ==2015), 4 ,12) 
    please help me

    Hi coool_sweet,
    According to your description, you created a variable of datetime type named edate and a variable of int, you want to use iif function in expression builder. If that is the case, we can use the expression like below:
    month( @[User::edate] ) == 2 && year( @[User::edate] ) ==2015? 4 : 12
    The following screenshot is for your reference:
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • JDeveloper SOA Expression Builder

    Hi
    I am not sure if this is the appropiate forum for this question or not but its the only forum related to JDeveloper.
    I am using JDeveloper 11.1.1.5.0 with the soa extension pack installed. When I access the Expression Builder from an assign activity, it takes at least a minute
    for the expression part of the windows to return and become editable. This is true regardless of whether it is a new expression I am creating or editing an
    existing expression.
    JDeveloper is installed on windows 7 64-bit edition and is configured to use 64-bit Java. Below are the options that are turned on from ide.conf
    AddVMOption -Xmx4000M
    AddVMOption -Xms1024M
    AddVMOption -Xverify:none
    and below are the options for jdev.conf
    AddVMOption -XX:MaxPermSize=768M
    AddVMOption -Xbootclasspath/p:../lib/lwawt.jar
    AddVMOption -Dsun.awt.keepWorkingSetOnMinimize=true
    AddVMOption -Dsun.java2d.noddraw=true
    AddVMOption -XX:+HeapDumpOnOutOfMemoryError
    AddVMOption -Doracle.jdeveloper.webservice.showAllOwsmPolicyTypes=false
    AddVMOption -Doracle.jdeveloper.webservice.hidePropertyOverride=false
    AddVMOption -Dsun.awt.disablegrab=true
    AddVMOption -XX:+UseCompressedOops
    Thanks
    Damien

    Hi,
    this part of the product is added as an extension by the SOA team. I suggest to try the SOA forum SOA Suite to see if someone ran into the same issue
    Frank

  • Trim value in ADF expression builder

    Hi,
    Can somebody tell me how can I trim a String using the expression builder from oracle ADF?
    My expression is #{row.bindings.Days.inputValue eq 'W' ? viewcontrollerBundle.WORKING_DAYS : viewcontrollerBundle.ALL_WEEK_DAYS} and I want to trim row.bindings.Days.inputValue.
    Sorry if the question is too easy but I didn't find something appropriate.
    Thank you.

    Hi,
    You can do it using JSTL function trim(), [URL http://blogs.oracle.com/adf/2011/04/string_manipulation_functions_inside_el.html]This blog has explanation for using JSTL substring function in EL, you can use trim() in the same way.
    Sample code:
    #{fn:trim(row.bindings.Days.inputValue) eq 'W' ? viewcontrollerBundle.WORKING_DAYS : viewcontrollerBundle.ALL_WEEK_DAYS}Sireesha

  • Expression Builder: convert string to number

    Hi all,
    I'm having trouble building a field validation rule for bank account numbers.
    The numbers have 12 positions, so I cannot use a string or text number.
    The validation rule to be implemented is that the last two digits are calculated based on the first 10 (modulo 97).
    However, when I use the Mid function to pick the first characters, I am unable to do any calculations on it. Apparently, the string to number conversion doesn't work (it should work when I read the manual, as it says that when using an operator between two data types, the second type is converted to the first (cf. example of 1234+abcd (should result in 1234 as to the manual))). So I tried '1*Mid(...)' or '0+Mid(...)'. Syntactically the expression builder accepts it and I can save it. BUT when I change the particular value on the screen, it gives me an SSO error (not the Field Validation error message I entered).
    Why isn't there simply a function ToNumber (like ToChar)????? How could I workaround this?
    Any input very welcome!
    Frederik

    Apparently, I was a bit confused when typing the first sentence, it should be:
    The numbers have 12 positions, so I cannot use an integer or number data type, but have to use String.

  • Logical SQL about Expression Builder

    Dear all
    I am Michel.
    When I was always trouble,
    everyone will go to support this Forum, I am glad.
    I want to fix Logical SQL about Expression Builder of Oracle BI 11.1.1.3.
    In detail, Business each year, fiscal year you want to make is to display
    the beginning of the fiscal year of April 1, always, the data,
    "OUTPUT_DATE" from April until March the following year.
    Currently being output error is as follows.
    :[nQSError: 22020] Function Subtring ( argument 1) does not support non-text types. (HY000)
    I want to fix logical SQL is as follows.
    case when substring("app_support"."TABLE_NAME"."OUTPUT_DATE" from 4 for 5)
    in ('04','05','06','07','08','09','10','11','12')
    then Cast
         Concat
    Substring(
                   Cast(
                        "app_support"."TABLE_NAME"."OUTPUT_DATE" AS char
              FROM 4 for 8
         '04-01'
    AS DATE
    when substring("app_support"."TABLE_NAME"."OUTPUT_DATE" from 4 for 5)
    in ('01','02','03')
    then timestampadd(SQL_TSI_YEAR,-1,
         Cast
         Concat
              Substring(
                   Cast(
                       "app_support"."TABLE_NAME"."OUTPUT_DATE" AS char
                   FROM 4 for 8
              '04-01'
    AS DATE
    For reference, logical SQL follows,
    there is no error, and it is operating normally.
    Cast
         Concat(
              Substring(
                   Cast(
                        "app_support"."TABLE_NAME"."OUTPUT_DATE" AS char
              FROM 0 for 5
         '-01')
    AS DATE
    I will grad to reply message.
    Thanks and regards.

    Dear Fame and all
    Hello.Thanks you for reply.
    Hi,
    You Missed END key word in the statement.Sorry,I mistake copy & paste only.
    So,The problem is still not resolved.
    The following shows, that the error has been corrected in the first message.
    Dear all
    I am Michel.
    When I was always trouble,
    everyone will go to support this Forum, I am glad.
    I want to fix Logical SQL about Expression Builder of Oracle BI 11.1.1.3.
    In detail, Business each year, fiscal year you want to make is to display
    the beginning of the fiscal year of April 1, always, the data,
    "OUTPUT_DATE" from April until March the following year.
    Currently being output error is as follows.
    :[nQSError: 22020] Function Subtring ( argument 1) does not support non-text types. (HY000)
    I want to fix logical SQL is as follows.
    case when substring("app_support"."TABLE_NAME"."OUTPUT_DATE" from 4 for 5)
    in ('04','05','06','07','08','09','10','11','12')
    then Cast
    Concat
    Substring(
    Cast(
    "app_support"."TABLE_NAME"."OUTPUT_DATE" AS char
    FROM 4 for 8
    '04-01'
    AS DATE
    when substring("app_support"."TABLE_NAME"."OUTPUT_DATE" from 4 for 5)
    in ('01','02','03')
    then timestampadd(SQL_TSI_YEAR,-1,
    Cast
    Concat
    Substring(
    Cast(
        "app_support"."TABLE_NAME"."OUTPUT_DATE" AS char
    FROM 4 for 8
    '04-01'
    AS DATE
    end
    For reference, logical SQL follows,
    there is no error, and it is operating normally.
    Cast
    Concat(
    Substring(
    Cast(
    "app_support"."TABLE_NAME"."OUTPUT_DATE" AS char
    FROM 0 for 5
    '-01')
    AS DATE
    I will grad to reply message.
    Thanks and regards.

  • Using Decode in Expression Builder...

    Hi everybody,
    I want to use the DECODE function of SQL in an Expression Builder....
    Of course this function does not exist in any of the transformation categories(arithmetic,character,e.t.c.) in the expression builder.
    I have read in the OWB on-line help that in the Expression Builder there should be an 'Others' drop - down list in order to select any of the available SQL clauses - one of them is 'decode'...
    The problem is that this drop - down list in the Expression Builder is disabled.....
    How can I use this function anyway..????
    Instead of using ... in the Expression Builder...
    decode(<column_name>,'1','val_one','2','val_two') what can I use to do the same....???
    As regards the problem that the drop-down list is disabled , what may be the cause..???
    I use Microsoft XP machine , Oracle 10g (v.10.2) and OWB v.10.1.0.4
    The documentation says....
    "This allows you to deploy the DECODE functionality in all operating modes (setbased, rowbased, etc.) and transparently across Oracle database releases (8.1, 9.0 and 9.2)."
    The above means that the cause is the incompatibility..????
    Thanks , a lot
    Simon

    I am using OWB 9.2.0.8 and I can't reproduce the problem you are having with 10.1, but did you try just typing it into the expression?
    Or, better yet, use CASE. The syntax is easier to read. I think OWB translates DECODEs to CASE when the SQL is generated.
    (Case <column_name>
       When '1' Then 'val_one'
       When '2' Then 'val_two'
    End)

  • How to use SQL OVER and PARTITION BY in OBIEE Expression Builder??

    Hi there,
    I want to create a new logical coulmn with the following SQL query.
    SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C,Inventory Detail.D,MyDATE )/SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C )
    How to use the OVER and PARTITION BY in OBIEE Expression Builder??
    Thanks in Advance

    hi bipin,
    We cant use by in Expression builder(rpd) .But use the same formula like this in Fx of answers
    SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C,Inventory Detail.D,MyDATE )/SUM(Inventory Detail.Qty) >OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C )SUM(Inventory Detail.Qty by Detail,ITEM,Mydate)/SUM(qty by detail,item)
    First check the numerator whether it was giving correct results or not then go with denominator
    compare the results with sql that u have
    Let me know if that does work
    thanks,
    saichand.v
    Edited by: Saichand Varanasi on Jul 27, 2010 9:27 PM
    Edited by: Saichand Varanasi on Jul 27, 2010 9:28 PM

  • Checking for empty tags using expression builder for XPATH

    I am creating several filters in a mediator for several parallel paths. I am trying to route the mediator to the correct DB adapter based on what tags are empty in the incoming XML. The XML has 1 required tag and 3 optional. So for the expression, I am using the expression builder to load the tag name then putting either [text()] or [not(text())] immediately after each tag with an "and" in between for the 3 optional elements. The problem I am having is they always return false. For example, if I enter a value for an optional tag and put [text()] after it, it evaluates to false. What is the correct way to check if an element has text or not?
    Thanks in advance!

    Hi,
    Its not recognizing the getVariableData func... instead try this:
    string-length(xpath)>0
    ex: string-length($in.body/imp1:manoj/imp1:C1)>0
    It works... Happy deploying ... :)

  • How to use TRUNC function with dates in Expression Builder in OBIEE.

    Hi There,
    How to use TRUNC function with dates in Expression Builder in OBIEE.
    TRUNC (SYSDATE, 'MM') returns '07/01/2010' where sysdate is '07/15/2010' in SQL. I need to use the same thing in expression builder in BMM layer logical column.
    Thanks in advance

    use this instead:
    TIMESTAMPADD(SQL_TSI_DAY, ( DAYOFMONTH(CURRENT_DATE) * -1) + 1, CURRENT_DATE)

  • Using case statement in OWB expression builder

    Hi All,
    We are using OWB version 10.2.0.1.0. While using the below case statement We are getting the validation message as 'The expression is not properly formed'.
    Case statement used in expression builder:
    case when (INGRP1.CHARGETYPE in ('O','F') or INGRP1.TARIFF_GROUP in ('SMSINT','MMSINT')or ( INGRP1.CALL_TYPE = '002' and INGRP1.TARIFF_GROUP = 'MTV'))
    then
    (select call_zone_reltn_key from call_zone_reltn where
    call_zone_cd=substr(case
                   when substr( INGRP1.B_SUBNO,1,2)='00'
                   then
                   substr( INGRP1.B_SUBNO,3)
                   else substr( INGRP1.B_SUBNO,1)
                   end,1,length(call_zone_cd))and rownum=1)
    else -1
    end
    Kindly help me out in fixing this error or suggest any alternate way to use the above query in OWB expression builder.
    Thanks,
    Kabilan

    946887 wrote:
    Hi All,
    We are using OWB version 10.2.0.1.0. While using the below case statement We are getting the validation message as 'The expression is not properly formed'.
    Did you try to deploy the mapping ? Some time the expression validator gives wrong error messege.
    Try to deploy the mapping and see if you are still getting this issue
    Case statement used in expression builder:
    case when (INGRP1.CHARGETYPE in ('O','F') or INGRP1.TARIFF_GROUP in ('SMSINT','MMSINT')or ( INGRP1.CALL_TYPE = '002' and INGRP1.TARIFF_GROUP = 'MTV'))
    then
    (select call_zone_reltn_key from call_zone_reltn where
    call_zone_cd=substr(case
                   when substr( INGRP1.B_SUBNO,1,2)='00'
                   then
                   substr( INGRP1.B_SUBNO,3)
                   else substr( INGRP1.B_SUBNO,1)
                   end,1,length(call_zone_cd))and rownum=1)
    else -1
    end
    Kindly help me out in fixing this error or suggest any alternate way to use the above query in OWB expression builder.
    Thanks,
    Kabilan

  • Why is ADF Bindings node not displayed in Expression Builder window?

    Hello,
    I'm using Oracle JDeveloper Studio Edition Version 11.1.1.1.0, and I've created a Fusion Web Application and I've configured ADF Authentication and Security for my web project, using the provided wizard.
    On a certain page, I've placed a Go Link component, and I'm trying to edit the Text and Destination Property using EL Expressions. When I open the Expression Builder window all I can see are the following nodes: ADF Controller Objects, ADF Managed Beans, JSF Managed Beans and JSP Objects, but no ADF Bindings. I need to access the securityContext properties, and from what I've read in B31974-03, I need ADF Bindings.
    Also, I've tryied using the search field from the Expression Builder windows, without any luck.
    This is probably a newbie problem, but I really can't figure it out. Please help.
    Bogdan.

    Hi,
    maybe your problem is that you don't have created pageDef related with your page. Try right click on your page and Go To Page Definition. It will create the related pageDef if it does not exist.
    Hope this helps
    Joseba

Maybe you are looking for