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)

Similar Messages

  • OWB Error for using Decode in Expression

    Debug code deployment messages:
    LINE 4558 ,COLUMN 71:
    PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL statement only
    LINE 4558 ,COLUMN 17:
    PL/SQL: Statement ignored
    End debug code deployment messages
    DBG1012: Debug deployment errors, can't run debug code.

    What i have experience is that if you use Decode inside the expression the OWB cannot validate it .
    But it will execute perfect.
    Use Case statement so that you can validate it and debug then
    Cheers
    Nawneet

  • How to use selectBooleanCheckbox in expression builder

    Hi
    I have a selectBooleanCheckbox on my UI as below.
    <af:selectBooleanCheckbox id="sbtFlg"
          label="Enable/Disable SUBMIT button"
           binding="#{pageFlowScope.invoiceTableManagedBean.submitBtnActive}"/>I am setting the value of this component in the listener 'SubmitButtonListener' as below
        RichSelectBooleanCheckbox submitFlag = (RichSelectBooleanCheckbox)context.getViewRoot().findComponent("sbtFlg");
        String id = actionEvent.getComponent().getId();
        log.info("+++++ Component id ++++ "+ id);
    //Here is some logic to get the     allRows object
        if( allRows.length == 0) {
            log.info(">> length ==0");
            //submitFlag.setSelected(false);
            submitFlag.setValue("false");
        }else{
         //submitFlag.setSelected(true);
          submitFlag.setValue("true");
        }Now I want to use the boolean value of the checkbox on disable property of commandButton.
    <af:commandToolbarButton actionListener="#{invokeActionBean.setOperation}"
                                                   text="#{wf:getResourceValue('SUBMIT', 'bindings.customActions')}"
                                                   disabled="#{!pageFlowScope.attachmentListManagedBean.areAllRequiredDocumentsAttached or !pageFlowScope.invoiceTableManagedBean.submitBtnActive}"
                                                   action="#{invokeActionBean.invokeOperation}"
                                                   partialSubmit="false"
                                                   immediate="true"
                                                   rendered="#{lOVManagedBean.initiator}"
                                                   visible="#{wf:isCustomActionAvailable('SUBMIT', 'bindings.customActions')}"
                                                   id="submitButton">
                            <f:actionListener type="com.bmc.crms.listener.SubmitButtonListener"/>Is this a right way to call this property?
    pageFlowScope.invoiceTableManagedBean.submitBtnActive"
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    I tried the following with your suggestion.
    Submit button code
    <af:commandToolbarButton actionListener="#{invokeActionBean.setOperation}"
                                                   text="#{wf:getResourceValue('SUBMIT', 'bindings.customActions')}"
                                                   disabled="#{!pageFlowScope.attachmentListManagedBean.areAllRequiredDocumentsAttached or !pageFlowScope.invoiceTableManagedBean.submitBtnActive}"
                                                   action="#{invokeActionBean.invokeOperation}"
                                                   partialSubmit="false"
                                                   immediate="true"
                                                   rendered="#{lOVManagedBean.initiator}"
                                                   visible="#{wf:isCustomActionAvailable('SUBMIT', 'bindings.customActions')}"
                                                   id="submitButton">
                            <!-- <f:actionListener type="com.bmc.crms.listener.SubmitButtonListener"/> -->
                            <f:actionListener type="com.bmc.crms.listener.RoleChangeListener"/>Button on which I want to call he listener wherein I am setting the boolean value
    <af:commandButton text="Add Invoice" id="addInvoiceButton"
                                            rendered="#{lOVManagedBean.initiator}"
                                            action="#{pageFlowScope.invoiceTableManagedBean.addInvoice}"
                                            actionListener="#{bindings.execute.execute}">
                            <f:actionListener type="com.bmc.crms.listener.SubmitButtonListener"/>
                             <f:actionListener type="com.bmc.crms.listener.MRFlagListener"/>   
                         </af:commandButton>Checkbox component
    <af:selectBooleanCheckbox id="sbtFlg"
                                                    label="Enable/Disable SUBMIT button"
                                                    value="#{pageFlowScope.invoiceTableManagedBean.submitBtnActive}"/>  Listner
      public void processAction(ActionEvent actionEvent){
        log.info("+++++ SubmitButtonListener.processAction() start++++ ");
        Map pageFlowScope = RequestContext.getCurrentInstance().getPageFlowScope();
        InvoiceTableManagedBean invoiceTblBean = (InvoiceTableManagedBean)pageFlowScope.get("invoiceTableManagedBean");
        // or InvoiceTableManagedBean invoiceTblBean = (InvoiceTableManagedBean)pageFlowScope.get("InvoiceTableManagedBean");
        invoiceTblBean.setSubmitBtnActive(true);
        FacesContext facesCtx = FacesContext.getCurrentInstance();
        UIComponent uiComponent = facesCtx.getViewRoot().findComponent("submitButton");
        AdfFacesContext.getCurrentInstance().addPartialTarget(uiComponent);
        log.info("+++++ SubmitButtonListener.processAction() end ++++ ");
    }However, on execution I get the following errorfor the SubmitButtonListner.
    ]] Root cause of ServletException.
    javax.servlet.jsp.JspException: com.bmc.crms.listener.SubmitButtonListener
         at com.sun.faces.taglib.jsf_core.ActionListenerTag.doStartTag(ActionListenerTag.java:179)
         at oracle.jsp.runtime.tree.OracleJspIterationTagNode.executeHandler(OracleJspIterationTagNode.java:43)
         at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
         at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
         at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
         at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
         at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
         at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
         at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
         at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
         at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
         at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
         at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
         at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
         at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)Am I doing anything wrong here?

  • 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

  • How to use DECODE function in Exspression?

    Hi,
    Can we use DECODE in Expression?
    I'm trying to use DECODE function but there is an error during the validation. But when i validate the mapping, it is successfully compiled but it is failed during deployment.
    But if I use CASE instead of DECODE, it works fine.
    Can we use DECODE in OWB???
    Thanks
    Raj

    Hi,
    In OWB 10gR2, if your are using only one DECODE in an expression, it's working. The package will compile when deploying the mapping. OWB will replace the DECODE by a CASE.
    But when you are using nested decode in an expression ( for example : decode(col1, 1, 'M', decode(col2, 'Madame', 'Mme', null)) ) only the first one is replaced by a case at deployment.
    In ROW_BASED mode, text of the expression is used outside of an sql statement and deployment will fails with "PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL statement only."
    If operating mode for the mapping is set to SET_BASED, it's working because the expression is used in an sql statement.
    I have logged a SR in metalink for this issue and a bug is opened (bug 5414112).
    But I agree with you, it's better to use case statement.
    Bernard

  • 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

  • Can multi-select picklist be used in Expression Builder?

    Does CRMOD allow the use of multi-slect picklist in Expression Builder within workflow?

    Thanks Suddu your process worked. This can be done it is just a little more manual than being able to select the field from the drop down list.
    To do this go to Admin, Application Customization, choose your record type, then Field Setup. Click on Rename Fields, then Advanced and copy the multi-select picklist field. Paste it into expression builder and at the end of the name add _ITAG. You will also need to add the brackets as well. Doing this will allow you to use a mspl in expression builder.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Using managed bean method in expression builder

    Hello,
    I'm new to adf and I have the following problem.
    I have a managed bean in session scope that has the following method:
    public boolean alertMessages() throws NamingException,
    SQLException {
    if (condition)
    {  return true;}
    else
    {return false;}
    I have a page that has a link. Using the expression builder and according the function result I want to make the link bold or not.
    I use the expression #{sessionScope.backing_pages_index.alertMessages ?'bold':'normal'} but it does'n work.
    Could anybody help me.
    Thank you,

    Hi..
    If you add your bean as sessionScope No need to add sessionScope to EL front,and should setter and getter for alertMessages
    use *font-weight:#{backing_pages_index.alertMessages ? 'bold':'normal'}*
    try as follows it is working for me
    > private boolean alertMessages;
    > public void setAlertMessages(boolean alertMessages) {
    > this.alertMessages = alertMessages;
    > }
    > public boolean isAlertMessages() {
    > if (true) {
    > return true;
    > } else {
    > return false;
    > }
    > }
         <af:commandLink text="commandLink 1" id="cl1" action="CustomPage"> inlineStyle="font-weight:#{backing_pages_index.alertMessages ? 'bold':'normal'};"/>

  • Using expression builder

    hi,
    how can i use where condition at expression builder at admin tool, can you share sytax please?

    Hi,
    Whenever you click on the expression builder the syntax will be shown to you as soon as you click on the functions or any object you select.
    In the logical table source, content tab, where clause, whatever condition you specify it gets reflected in the query when ever you pull the columns from the table.
    For example-
    If you are specifing the condition as
    Region_name='Asia'
    Then when ever you pull the columns from the table then the data will get restricted with 'Asia' data only.
    You can als call functions, session variables.
    Hope this helped/ answered.
    Regards
    MuRam

  • Using DECODE, CASE

    Hi All,
    The Transformation Guide of OWB mentions that DECODE, CASE can be used. But I am unable to find either of these functions in the Expression Builder. Can you please tell me wher should I search for these functions, or if you could tell me if there is any other way of implementing IF THEN ELSE logic.
    -Arnab

    Hello Arnab,
    Just type your CASE ... END expression directly in the expr. builder window.
    Always press the Validate button for syntax verification when you have changed your expression.
    Regards, Hans Henrik

  • 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.

  • How to use the Dynamic Expression in BRFplus

    Hi Experts
                   I am new to BRFplus. Can you give any document on BRFplus how to use the Dynamic Expression.
    Thankyou
    Venkat

    OK I tried it and worked but for one condition:
    WHERE DECODE (E.qualification_sid, 1104,
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.spe_per)+1),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.mili_yea_per)+1))
         BETWEEN TO_DATE('01-07-2011', 'DD-MM-RR') AND TO_DATE('31-07-2011', 'DD-MM-RR')
    But how to put two conditions for the same Expression:
    WHERE DECODE ((E.qualification_sid, 1104) AND (E.RANK_SID, 8),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.spe_per)+1),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.mili_yea_per)+1))
         BETWEEN TO_DATE('01-07-2011', 'DD-MM-RR') AND TO_DATE('31-07-2011', 'DD-MM-RR')
    The previous code gives me this error: missing right parenthesis

  • How to use the CASE Expression in Where Cluase?

    Hi All,
    I'm trying to use the CASE Expression in the Where Clause at some trigger on the Form?
    I've tried this Code:
    Declare
    N Number;
    begin
    SELECT COUNT(E.EMP_SID)
         INTO N
         FROM EMPLOYEES E, RANKS R
         WHERE CASE WHEN R.qualification_sid = 1104 AND E.rank_sid = 8 THEN
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.spe_per)+1)
         ELSE
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.mili_yea_per)+1)
         END
         BETWEEN TO_DATE('01-07-2011', 'DD-MM-RR') AND TO_DATE('31-07-2011', 'DD-MM-RR');
    END;
    When I run this code as a normal query at any SQL editor it works successfully, But When I Compile it at some trigger on the Form it gives me this error:
    Encountered the symbol "CASE" when expecting one of the following:
    ( - + mod ......
    Heeey how to specify the previous code to be shown as code in the thread?
    Note: I'm using Forms 6i

    OK I tried it and worked but for one condition:
    WHERE DECODE (E.qualification_sid, 1104,
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.spe_per)+1),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.mili_yea_per)+1))
         BETWEEN TO_DATE('01-07-2011', 'DD-MM-RR') AND TO_DATE('31-07-2011', 'DD-MM-RR')
    But how to put two conditions for the same Expression:
    WHERE DECODE ((E.qualification_sid, 1104) AND (E.RANK_SID, 8),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.spe_per)+1),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.mili_yea_per)+1))
         BETWEEN TO_DATE('01-07-2011', 'DD-MM-RR') AND TO_DATE('31-07-2011', 'DD-MM-RR')
    The previous code gives me this error: missing right parenthesis

Maybe you are looking for