Set where Clause parameter using UIX

I am using uiXML to generate a table which is associated to a ViewObject. The query of the ViewObject has bind variable for date. I would like to display a report (i.e table) with the values from ViewObject corresponding to dates (from & to) set using the bind variable. In other words, I would like to set the value for the bind variable from UIX just before displaying the table. My code is as follows:
<bc4j:rootAppModuleScope name="QnAMainRepView1AppModule">
<contents>
<form name="QnAFrm">
<contents>
<bc4j:viewObjectScope name="QnAMainRepView1">
<contents>
<bc4j:table name="QnATbl" width="100%">
<bc4j:keyStamp>
<bc4j:rowKey name="key"/>
</bc4j:keyStamp>
<contents>
<bc4j:column attrName="HostName">
<columnHeader>
<bc4j:sortableHeader text="Host"/>
</columnHeader>
<contents>
<bc4j:input readOnly="true"/>
</contents>
</bc4j:column>
<bc4j:column attrName="ModuleName">
<columnHeader>
<bc4j:sortableHeader text="Module"/>
</columnHeader>
<contents>
<bc4j:input readOnly="true"/>
</contents>
</bc4j:column>
<bc4j:column attrName="Description">
<columnHeader>
<bc4j:sortableHeader/>
</columnHeader>
<contents>
<bc4j:input readOnly="true"/>
</contents>
</bc4j:column>
<bc4j:column attrName="Count1">
<columnHeader>
<bc4j:sortableHeader text="Count"/>
</columnHeader>
<contents>
<bc4j:input readOnly="true"/>
</contents>
</bc4j:column>
<bc4j:column attrName="Gmt">
<columnHeader>
<bc4j:sortableHeader text="GMT"/>
</columnHeader>
<contents>
<bc4j:dateField readOnly="true">
<onSubmitValidater>
<date dateStyle="long"
pattern="MM-dd-yyyy 'at' hh:mm:ss"/>
</onSubmitValidater>
</bc4j:dateField>
</contents>
</bc4j:column>
<column>
<columnHeader>
<sortableHeader text="Local Time"/>
</columnHeader>
<contents>
<dateField readOnly="true" value="2003-01-25">
<onSubmitValidater>
<date dateStyle="long"
pattern="MM-dd-yyyy 'at' hh:mm:ss"/>
</onSubmitValidater>
</dateField>
</contents>
</column>
</contents>
</bc4j:table>
</contents>
</bc4j:viewObjectScope>
</contents>
</form>
</contents>
</bc4j:rootAppModuleScope>
In the above, QnAMainRepView1 is the ViewObject which has bind variables. How do I set the value for the bind variable before the table is drawn?
Thank you very much for your help.
Jayasree

I'm try implement this feature, but my Page return the follow error:
oracle.jbo.SQLStmtException: JBO-27122: Error during preparation for instruction. Instruction: SELECT A.COD_CLIENTE, A.SEQ_ESCOLA, A.SEQ_CAMPUS, (select b.nom_escola from ed_escola b where a.cod_cliente = b.cod_cliente and a.seq_escola = b.seq_escola) AS DspNomEscola, A.STA_PRINCIPAL, A.COD_PESSOA, A.NOM_CAMPUS, A.STA_CNPJ, A.NUM_CNPJ, A.STA_FUNCIONAMENTO, A.TIP_DEPENDENCIA, A.TIP_ZONA, A.COD_GEOPROCESSAMENTO, A.QTD_M2_CONSTRUIDA, A.QTD_M2_TOTAL, A.NUM_DEPENDENCIA_OUES, A.NUM_CADASTRO_IMOB, A.COD_PESSOA_PRO, A.TIP_ESGOTO_SANITARIO, A.TIP_OCUPACAO_IMOVEL, A.TIP_ESFERA_PESSOA_PRO, A.SEQ_ESCOLA_DEP, A.SEQ_TIPO_LOCAL_CAMPUS, A.COD_CLASSE_LOCAL_CAMPUS, A.SEQ_TIPO_DESTINO_LIXO, A.COD_CLASSE_DESTINO_LIXO FROM ED_ESCOLA_CAMPUS A WHERE cod_cliente = ?
at oracle.jbo.server.QueryCollection.executeQuery(QueryCollection.java:608)
at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(ViewObjectImpl.java:2600)
at oracle.jbo.server.ViewRowSetImpl.execute(ViewRowSetImpl.java:521)
at oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed(ViewRowSetIteratorImpl.java:2197)
at oracle.jbo.server.ViewRowSetIteratorImpl.first(ViewRowSetIteratorImpl.java:1141)
at oracle.jbo.server.ViewRowSetImpl.first(ViewRowSetImpl.java:2240)
at oracle.jbo.server.ViewObjectImpl.first(ViewObjectImpl.java:4345)
at oracle.cabo.data.jbo.ui.data.RowSetDataProvider.init(Unknown Source)
at oracle.cabo.ui.data.provider.TableDataProvider.init(Unknown Source)
at oracle.cabo.ui.data.provider.CachingDataProvider.init(Unknown Source)
at oracle.cabo.ui.data.provider.DataProviderStack.addDataProvider(Unknown Source)
at oracle.cabo.ui.LogicalNodeRenderingContext.addDataProvider(Unknown Source)
at oracle.cabo.ui.composite.CompositeRenderingContext.addDataProvider(Unknown Source)
at oracle.cabo.ui.laf.base.DataScopeRenderer.prerender(Unknown Source)
at oracle.cabo.ui.BaseRenderer.render(Unknown Source)
at oracle.cabo.ui.BaseUINode.render(Unknown Source)
at oracle.cabo.ui.BaseUINode.render(Unknown Source)
at oracle.cabo.ui.composite.UINodeRenderer.renderWithNode(Unknown Source)
at oracle.cabo.ui.composite.UINodeRenderer.render(Unknown Source)
My ViewObject have the SQL Statment:
select a.cod_cliente,
a.seq_escola,
a.seq_campus,
from ed_escola_campus a
where cod_cliente = ?
package br.com.siadem.siaed.ed00010;
import javax.servlet.ServletConfig;
import oracle.jbo.ViewObject;
import oracle.cabo.ui.RenderingContext;
import oracle.cabo.servlet.BajaContext;
import oracle.cabo.servlet.Page;
import oracle.cabo.servlet.event.PageEvent;
import oracle.cabo.servlet.event.EventResult;
import oracle.cabo.servlet.ui.BajaRenderingContext;
import oracle.cabo.data.jbo.servlet.bind.ServletBindingUtils;
My Event Handler:
public class FunPreQuery
public EventResult handleEvent(BajaContext context, Page page, PageEvent event) throws Throwable
ViewObject view = ServletBindingUtils.getViewObject(context);
view.setWhereClauseParam(0, "1");
view.executeQuery();
return new EventResult(page);
My Page UIX:
<?xml version="1.0" encoding="windows-1252" ?>
<page xmlns="http://xmlns.oracle.com/uix/controller"
xmlns:ctrl="http://xmlns.oracle.com/uix/controller"
xmlns:ui="http://xmlns.oracle.com/uix/ui"
xmlns:bc4j="http://xmlns.oracle.com/uix/bc4j" >
<bc4j:registryDef>
<bc4j:rootAppModuleDef name="EdEscolaCampusView1AppModule"
definition="siaed.Ed00010Module"
releaseMode="stateful" >
<bc4j:viewObjectDef name="EdEscolaCampusView1"
rangeSize="10" >
<bc4j:rowDef name="UpdateEdEscolaCampusView1" autoCreate="false" >
<bc4j:propertyKey name="key" />
</bc4j:rowDef>
</bc4j:viewObjectDef>
</bc4j:rootAppModuleDef>
</bc4j:registryDef>
<content>
<try xmlns="http://xmlns.oracle.com/uix/ui"
xmlns:data="http://xmlns.oracle.com/uix/ui" >
<catch>
<displayException />
</catch>
<contents>
<!--
<switcher childName="default">
<boundAttribute name="childName">
<if>
<comparison type="equals">
<dataObject select="key" source="ctrl:page"/>
<dataObject source="ui:null"/>
</comparison>
<fixed text="error"/>
</if>
</boundAttribute>
<case name="error">
<header text="Required page property 'key' missing. Cannot display page."/>
</case>
<case name="default">
-->
<pageLayout xmlns="http://xmlns.oracle.com/uix/ui"
xmlns:data="http://xmlns.oracle.com/uix/ui"
title="Campus - Pesquisar" >
<contents>
<!-- this will contain any validation errors after form
submission -->
<messageBox automatic="true" />
<bc4j:rootAppModuleScope name="EdEscolaCampusView1AppModule" >
<contents>
<header text="Pesquisar" >
<contents>
<form name="search" method="POST" >
<contents>
<inlineMessage prompt="Condição" vAlign="middle" >
<contents>
<flowLayout>
<contents>
<choice name="attrName"
data:selectedValue="attrName@ctrl:page"
shortDesc="Search Column">
<contents>
<option text="Escola" value="SeqEscola" />
<option text="Código Campus" value="SeqCampus" />
<option text="Nome" value="NomCampus" />
</contents>
</choice>
<textInput name="attrValue" columns="20"
data:text="attrValue@ctrl:page"
shortDesc="Search"/>
</contents>
</flowLayout>
</contents>
<end>
<submitButton text="Pesquisar" ctrl:event="search" />
</end>
</inlineMessage>
</contents>
</form>
</contents>
</header>
<header text="Resultados" >
<contents>
<form name="viewForm" method="POST" >
<contents>
<tableLayout>
<contents>
<bc4j:viewObjectScope name="EdEscolaCampusView1" >
<contents>
<bc4j:table name="viewTable" width="80%"
alternateText="Nenhum registro encontrado">
<tableSelection>
<!-- single selection for each row in the table -->
<singleSelection selectedIndex="0" shortDesc="Select Row">
<contents>
<!-- the update button causes the currently selected
row to be sent to the update page -->
<submitButton text="alterar"
ctrl:event="update" />
<!-- the delete button causes the currently selected
row to be removed -->
<submitButton text="excluir"
ctrl:event="delete" />
</contents>
</singleSelection>
</tableSelection>
<!-- the key identifying the current row in the table -->
<bc4j:keyStamp>
<bc4j:rowKey name="key" />
</bc4j:keyStamp>
<contents>
<!-- A bc4j:column element is added for each attribute
in the ViewObject. -->
<bc4j:column attrName="SeqEscola">
<columnHeader>
<bc4j:sortableHeader text="Escola"/>
</columnHeader>
<contents>
<bc4j:input readOnly="true"/>
</contents>
</bc4j:column>
<bc4j:column attrName="SeqCampus">
<columnHeader>
<bc4j:sortableHeader text="Campus"/>
</columnHeader>
<contents>
<bc4j:input readOnly="true"/>
</contents>
</bc4j:column>
</contents>
</bc4j:table>
</contents>
</bc4j:viewObjectScope>
</contents>
</tableLayout>
</contents>
</form>
</contents>
</header>
</contents>
</bc4j:rootAppModuleScope>
</contents>
<contentFooter>
<!-- the create button redirects to the create page -->
<button text="Inserir" ctrl:event="inserir" />
</contentFooter>
</pageLayout>
</contents>
</try>
</content>
<handlers>
<event name="*">
<method name="br.com.siadem.siaed.ed00010.FunPreQuery"
method="handleEvent"/>
</event>
<event name="search" >
<!-- using the ApplicationModule causes it to be checked out from the
ApplicationPool. It is released using stateful mode. -->
<bc4j:findRootAppModule name="EdEscolaCampusView1AppModule" >
<!-- establish the ViewObject scope -->
<bc4j:findViewObject name="EdEscolaCampusView1" >
<!-- search for the view criteria -->
<bc4j:findByExample>
<bc4j:exampleRow ignoreCase="true" >
<bc4j:exampleAttribute>
<bc4j:nameBinding><bc4j:parameter name="attrName" /></bc4j:nameBinding>
<bc4j:valueBinding><bc4j:parameter name="attrValue" /></bc4j:valueBinding>
</bc4j:exampleAttribute>
</bc4j:exampleRow>
</bc4j:findByExample>
<bc4j:executeQuery/>
<!-- store the current search criteria as page properties -->
<bc4j:setPageProperty name="attrName" >
<bc4j:parameter name="attrName" />
</bc4j:setPageProperty>
<bc4j:setPageProperty name="attrValue" >
<bc4j:parameter name="attrValue" />
</bc4j:setPageProperty>
</bc4j:findViewObject>
</bc4j:findRootAppModule>
</event>
<event name="sort" source="viewTable" >
<!-- using the ApplicationModule causes it to be checked out from the
ApplicationPool. It is released using stateful mode. -->
<bc4j:findRootAppModule name="EdEscolaCampusView1AppModule" >
<!-- establish the ViewObject scope -->
<bc4j:findViewObject name="EdEscolaCampusView1" >
<!-- sort by the submitted attribute name -->
<bc4j:sort/>
</bc4j:findViewObject>
</bc4j:findRootAppModule>
</event>
<event name="goto" source="viewTable" >
<!-- using the ApplicationModule causes it to be checked out from the
ApplicationPool. It is released using stateful mode. -->
<bc4j:findRootAppModule name="EdEscolaCampusView1AppModule" >
<!-- establish the ViewObject scope -->
<bc4j:findViewObject name="EdEscolaCampusView1" >
<!-- navigate to the submitted range -->
<bc4j:goto/>
</bc4j:findViewObject>
</bc4j:findRootAppModule>
</event>
<event name="create" >
<!-- forward to the create page -->
<ctrl:go name="ed00010create" redirect="true" />
</event>
<event name="update" >
<!-- forward to the update page, passing the selected key
as a page property -->
<ctrl:go name="ed00010update" redirect="true" >
<ctrl:property name="key" >
<ctrl:selection name="viewTable" key="key" />
</ctrl:property>
</ctrl:go>
</event>
<event name="delete" >
<!-- using the ApplicationModule causes it to be checked out from the
ApplicationPool. It is released using stateful mode. -->
<bc4j:findRootAppModule name="EdEscolaCampusView1AppModule" >
<!-- establish the ViewObject scope -->
<bc4j:findViewObject name="EdEscolaCampusView1" >
<!-- find the selected Row -->
<bc4j:findRowByKey>
<bc4j:keyBinding>
<bc4j:selectionKey name="viewTable" key="key" />
</bc4j:keyBinding>
<bc4j:handlers>
<!-- remove the selected ViewObject row -->
<bc4j:removeRow />
<!-- execute the query to eliminate dead row access -->
<bc4j:executeQuery/>
</bc4j:handlers>
</bc4j:findRowByKey>
</bc4j:findViewObject>
<!-- commit the transaction, forwards to self automatically -->
<bc4j:commit/>
</bc4j:findRootAppModule>
</event>
</handlers>
</page>
Any body have a any idea for solution this problem ???
thanks,
Danilo

Similar Messages

  • Dynamically setting where clause parameter before the page load

    Hi Experts,
    I do have the following requirement.
    I am working on jsf page in ADF10.1.3.3. I have a View Object which displays the results on the screen. Can someone provide me some example where I can dynamically set the where clause parameter to my Query in VO before the Page Load happens(By Overriding the Prepare Model) and display results on screen.
    Thanks

    Hi,
    Thanks for yor advice.
    I need to write the method in Prepare Model method when the page loads and not in AM.
    Here in the page there is no action as such.
    On the Page load we need to directly set the Where Clause on the VO.
    Provide me some examples if any.
    Thanks

  • How to set Where clause in the View Object of the MessageChoice ?

    Hi,
    How to set Where clause in the View Object of the
    MessageChoice ?
    Example:
    <bc4j:rootAppModuleDef name="EdEscolaCampusView1AppModule"
    definition="ed00050.Ed00050Module"
    releaseMode="stateful" >
    <bc4j:viewObjectDef name="EdEscolaCampusView1" >
    <bc4j:rowDef name="CreateEdEscolaCampusView1" autoCreate="true" >
    <bc4j:propertyKey name="key" />
    </bc4j:rowDef>
    </bc4j:viewObjectDef>
    <bc4j:viewObjectDef name="ListaTipLocalView1"
    rangeSize="9999">
    </bc4j:viewObjectDef>
    </bc4j:rootAppModuleDef>
    </bc4j:registryDef>
    messageChoice declaration:
    <bc4j:messageChoice name="SeqTipoLocalCampus"
    attrName="SeqTipoLocalCampus"
    prompt="Local do Campus">
    <contents>
    <bc4j:optionList attrName="SeqTipoBasico"
    textAttrName="NomTipoBasico"
    voName="ListaTipLocalView1"/>
    </contents>
    </bc4j:messageChoice>
    I would like set where clause of ViewObject, with dinamic parameters (using attribute1 = :1), before populate messageChoice.
    thanks...
    Danilo

    Hi Andy,
    I try set a where clause using the message:
    Set where Clause parameter using UIX , but my UIX Page have 2 messageChoice's of different ViewObject's, then I need implement this Java Class:
    //Nome da Package da Tela Detail
    package br.com.siadem.siaed.ed00050;
    // Importa as Bibliotecas necessárias
    import oracle.jbo.ViewObject;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.client.Configuration;
    import oracle.cabo.servlet.BajaContext;
    import oracle.cabo.servlet.Page;
    import oracle.cabo.servlet.event.PageEvent;
    import oracle.cabo.servlet.event.EventResult;
    import oracle.cabo.data.jbo.servlet.bind.*;
    import oracle.cabo.ui.data.BoundValue;
    import oracle.cabo.ui.data.DataBoundValue;
    import javax.servlet.http.HttpServletRequest;
    import br.com.siadem.siaed.util.*;
    import javax.servlet.http.Cookie;
    import oracle.cabo.data.jbo.def.NestedAppModuleDef;
    import oracle.cabo.data.jbo.def.ViewObjectDef;
    import oracle.cabo.data.jbo.def.AppModuleDef;
    // Classe que configura os parametros para a execução da Query,
    // utilizando variáveis de Sessao
    public class FunPreQueryLista
    public static EventResult FunConfiguraQuery(BajaContext context, Page page, PageEvent event) throws Throwable
    // TrataDadosSessao - Classe utilizada para retornar os valores das variáveis de sessão genéricas
    // Ex: CodCliente, CodMunicipio etc...
    TrataDadosSessao varDadosSessao = new TrataDadosSessao();
    // 1o. Parametro Configurado - Através da classe TrataDadosSessao, utilizando um método Get
    // <alterar>
    String valor1 = varDadosSessao.getCodCliente();
    String valor2 = varDadosSessao.getCodMunicipio();
    //Cria o objeto que retorna o ApplicationModule
    ApplicationModule am = ServletBindingUtils.getApplicationModule(context);
    // Início das Configurações da Query da Lista
    //Cria o objeto que retorna o view object da lista desejada
    //alterar
    ViewObject TipoLocal = am.findViewObject("ListaTipoLocalView1");
    //Configuração dos parametros definidos na query do view Object
    //alterar
    TipoLocal.setWhereClauseParam(0,valor1);
    TipoLocal.setWhereClauseParam(1,valor2);
    // Executa a Query
    TipoLocal.executeQuery();
    // Fim das Configurações da Query da Lista
    // Início das Configurações da Query da Lista
    //Cria o objeto que retorna o view object da lista desejada
    //alterar
    ViewObject TipoDestLixo = am.findViewObject("ListaDestinoLixoView1");
    //Configuração dos parametros definidos na query do view Object
    //alterar
    TipoDestLixo.setWhereClauseParam(0,valor1);
    TipoDestLixo.setWhereClauseParam(1,valor2);
    // Executa a Query
    TipoDestLixo.executeQuery();
    // Fim das Configurações da Query da Lista
    // Retorna o Resultado para a Página
    return new EventResult(page);
    The code works very well...
    And, I'm sorry for my two repost's in UIX Forum about this in a few time.
    Thank very much...
    Danilo

  • Set Where Clause of VL Using Coding???

    How to Set Where Clause of VL(View Link) Using Coding???

    i think,if you can not change the VL def,change the SQL(like give a translate column)

  • Bc4j: set where clause at runtime for view objcet ?

    how to set where clause for a view object that is not put in a subselect at runtime ?
    select a.para_id, b.para_para_id
    from table1 a, table2 b
    need to set at runtime either:
    where a.para_id = b.para_para_id
    or:
    where a.para_id = b.para_para_id(+)
    problem is that bc4j is useing it as followed:
    select * from (
    select a.para_id, b.para_para_id
    from table1 a, table2 b
    ) where (a.para_id = b.para_para_id(+))
    cant use outer join like this
    any suggestions

    If you do not want to issue the framework built query, you may want to set the query for a VO yourself instead of setting just the where clause by using setQuery() api. TO revert back to framework built query, call setQuery(null).
    This way, when you need the xtra where-clause and not the "innerSQL stuff", you can build a custom sql with whereclause etc, and call setQuery(), execute that SQL, perform your tricks with the VO and then when the VO is usage is done, reset the VO query to original by calling setQuery(null).

  • Where-Clause-Question using "sets of values"

    Hello,
    I'm using 10gR2
    Is it possible to filter rows by using sets of values in the where-clause?
    E.g. like:
    SELECT a, b, c
      FROM mytable
      WHERE (b,c) IN
          (3,4),
          (6,7),
          (9,1),
          (0,2)
        )...should only retrieve rows from mytable with the sets (pairs) of above list

    Here is a link to the docs: [Expression Lists|http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions014.htm#i1033664]
    !http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14200/img/expression_list.gif!
    The number of expressions in each set must match the number of expressions before the operator in the comparison condition or before the IN keyword in the membership condition.

  • How to change access path for 'where' clause by using HINTS?

    I searched a loooot of posts and haven't found a solution for my case. I don't even know whether it is possible or not. Is it possible to change the sequence of Oracle "Predicate Information"?
    Here is my SQL and Oracle's execution plan.
      SELECT Max(logId) AS logId FROM online_users_t
      WHERE online_users_date >= to_date('2011-09-19 10:00:00') - 3.2 AND online_users_date <= to_date('2011-09-19 10:00:00') AND online_users_result in (1, -1)
      GROUP BY online_users_user
    | Id  | Operation                    | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT             |                    | 24800 |   629K|  1336   (1)| 00:00:17 |
    |   1 |  HASH GROUP BY               |                    | 24800 |   629K|  1336   (1)| 00:00:17 |
    |*  2 |   TABLE ACCESS BY INDEX ROWID| ONLINE_USERS_T     | 38833 |   985K|  1334   (1)| 00:00:17 |
    |*  3 |    INDEX RANGE SCAN          | ONLINE_USERS_T_IDX |   116K|       |   313   (1)| 00:00:04 |
    Predicate Information (identified by operation id):
       2 - filter("ONLINE_USERS_RESULT"=(-1) OR "ONLINE_USERS_RESULT"=1)
       3 - access("ONLINE_USERS_DATE">=TO_DATE(' 2011-09-16 05:12:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "ONLINE_USERS_DATE"<=TO_DATE(' 2011-09-19 10:00:00', 'syyyy-mm-dd
                  hh24:mi:ss'))I have 2 conditions in my 'where' clause, one is date range and the other is 'online_users_result in (1, -1)'. It seems that Oracle filter the table by using 'online_users_result in (1, -1)' first, then access it through date range.
    What I want to do is firstly filtering the table by using date range followed by other things. How can I do it?
    Any clue or help would be highly appreciated.
    Thanks in advance.

    It seems that Oracle filter the table by using 'online_users_result in (1, -1)' first, then access it through date range. No it's not.
    What I want to do is firstly filtering the table by using date range followed by other things. How can I do it?That's precisely what it's doing now.
    It is using the T_IDX index to quickly find all rows that satisfy the range predicate on the date column.
    And then filter those rows to only retrieve the ones that satisfy the other predicate (... in (1,-1)).

  • Group by, setting where clause in View Objects

    Hello,
    I have a problem with View Objects in BC4j. Cause I cannot use a column in the where clause of a view object that is not also an attribute of the view object, I am unable to group a statement as I want to. Is there a way to solve this problem?
    Thanks in advance!
    Britta

    What version are you using..I tried a simple WHERE clause using an attribute which is not part of the VO and that works ok....
    Thanks
    Grant Ronald
    Oracle Product Management

  • Where clause and using dates

    Hi all,
    How to use the where clause to select records based on condition,,,,, and this condition is based on a date,, for example:
    select items from inventory_items
    where purchasing_date in :from_date and :to_date;
    Thank you very much
    Tasneem

    Tasneem wrote:
    Hi all,
    How to use the where clause to select records based on condition,,,,, and this condition is based on a date,, for example:
    select items from inventory_items
    where purchasing_date in :from_date and :to_date;
    Thank you very much
    Tasneemtry this..
    select items from inventory_items
    where purchasing_date between :from_date and :to_date;
    If someone's response is helpful or correct, please mark helpful or correct.

  • Programatically set where clause or view criteria not working in managed bean

    I get a view using finditerator then then apply setwhere or view criteria but it does not filter the original rows. code is as follows
    DCIteratorBinding dcIter3 =
    ADFUtils.findIterator("PlanColorsIterator");    
    ViewObject cvo = dcIter3.getViewObject();
    cvo.setNamedWhereClauseParam("Plno","4000");  // not working
       /*   // not working
    cvo.applyViewCriteria(cvo.getViewCriteriaManager().getViewCriteria("PlanColorsCriteria"));
    cvo.ensureVariableManager().setVariableValue("Plno", "4000");
    cvo.executeQuery();
    /* not working
    cvo.setWhereClause("plan_no = :ThePlanType");
    cvo.defineNamedWhereClauseParam("ThePlanType", null, null);
    cvo.setNamedWhereClauseParam("ThePlanType", "4000");
    cvo.executeQuery();

    thanks for reply.
    Jdeveloper version is 11.1.1.4.0.
    Actually the vo on which I am trying to set set where is used as source to act as cursor  to get values from filtered rows using set where and copy the this cursor values to another target vo. I am not showing these source values just getting values.
    DCIteratorBinding dcIter2 =
    ADFUtils.findIterator("PlotDtl2Iterator");     
    ViewObject dvo = dcIter2.getViewObject();
    // colors to copy 
    DCIteratorBinding dcIter3 =
    ADFUtils.findIterator("PlanColorsIterator");    
    ViewObject cvo = dcIter3.getViewObject();
    cvo.setNamedWhereClauseParam("Plno","4000");
    cvo.applyViewCriteria(cvo.getViewCriteriaManager().getViewCriteria("PlanColorsCriteria"));
    cvo.ensureVariableManager().setVariableValue("Plno", "4000");
    cvo.executeQuery();
    cvo.setWhereClause("plan_no = :ThePlanType");
    cvo.defineNamedWhereClauseParam("ThePlanType", null, null);
    cvo.setNamedWhereClauseParam("ThePlanType", "4000");
    cvo.executeQuery();
    int totalCount=cvo.getRowCount();
    cvo.setRangeSize(totalCount);
    Row[] rArray=cvo.getAllRowsInRange();
    for (Row r:rArray){
    NameValuePairs nvp = new NameValuePairs();      
    nvp.setAttribute("Description",r.getAttribute("Description"));
    nvp.setAttribute("PlanNo",r.getAttribute("PlanNo"));
    nvp.setAttribute("MainAcc",r.getAttribute("MainAcc"));
    nvp.setAttribute("Plqty",r.getAttribute("Qty"));
    nvp.setAttribute("Cdkid",r.getAttribute("CdkId"));
    nvp.setAttribute("FabricCode",r.getAttribute("FabricCode"));
    nvp.setAttribute("DyeWash",r.getAttribute("DyeWash"));
    //  nvp.setAttribute("Description","test");
    Row drow = dvo.createAndInitRow(nvp);      
    dvo.insertRow(drow); 

  • Dimension Mapping in 11g. Can Where clause be used to filter source table?

    Hi,
    Is it possible to use a where clause filter when mapping a dimension to source table in AWM 11g
    My understanding of the user guide is that filters can only be used in cube mapping?
    I am using AWM 11.2.0.1.0A on db 11g R2.
    I presume I could use a database view on the source table to filter down to the records for the dimension, however, I understand this would then prevent me refreshing any cube using this dimension using materialized view refresh?
    Thanks

    Yes, you can apply a where clause on a dimension map, but it is not exposed through AWM. You would need to add an attribute to the XML of the form
    WhereClause='<source table condition>'For example, you could add this to a HierarchyLevelMap.
    <HierarchyLevelMap
      WhereClause="CUSTOMER_DIM.SHIP_TO_ID = 123"
      KeyExpression="CUSTOMER_DIM.SHIP_TO_ID"
      Query="CUSTOMER_DIM">
    </HierarchyLevelMap>Make sure you add it to all relevant levels in a hierarchy. E.g. all levels that share the same source table. This is compatible with MV refresh. You can also map it to a view containing the where clause, and that, too, should work with MV refresh.

  • Filter Records in WHERE clause iReports using values passed from a prgram

    I have searched for iReports manual and what i can see are docs on sale. I have managed to create jrxml file, execute it in jsp and actually view the report.
    Now i have a big list of customers from various branches and have various categories. I would like to know how to pass the parameters so that i retrieve a small list of items. e.g. WHERE cu.branch=200 AND cu.category=10. That is i would like to pass 20 and 10 to the jrxml query stored.
    In iReports i saw parameters, variables and fields but it seems like these are displayable fields.
    How will i achieve this. Am seeking for assistance.
    null

    >
    Please help me to use an associate array in SQL query (WHERE clause).
    select *
    bulk collect into some_array
    >
    there is no variable 'some_array' in what you posted.
    If you want help with your code you have to post the code you are really using, not some hacked-up version of it that has errors.
    Here is sample code that shows how to treat a collection as a table using the TABLE operator
    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
    declare
    tb emp_table_type;
    deptnoList sys.OdciNumberList;
    BEGIN
    select emp_scalar_type(empno, ename, job, mgr, hiredate, sal, comm, deptno)
    bulk collect into tb from emp;
    SELECT deptno bulk collect
    INTO deptnoList
    FROM dept where deptno not in (select deptno from table(tb));
    for i in 1..deptnoList.count loop
    dbms_output.put_Line(deptnoList(i));
    end loop;
    END;Note that tb is a collection and is useds in the subquery 'select deptno from table(tb)'.

  • Issue with dynamically setting where clause in OAF

    Hi All,
    I have a View object having the query below:
    SELECT  rownum LINENUM,
            B.line_id LINE_ID,
            B.INVENTORY_ITEM_ID INVITMID ,
            B.QUANTITY_DELIVERED PICKQTY         
    from   MTL_TXN_REQUEST_HEADERS A,
            MTL_TXN_REQUEST_LINES  B
      WHERE A.HEADER_ID=B.HEADER_ID
       AND A.MOVE_ORDER_TYPE=2 
       AND 'on'=:1
       AND B.TO_SUBINVENTORY_CODE=NVL(:4,B.TO_SUBINVENTORY_CODE)
       AND A.request_number=NVL(:5,A.REQUEST_NUMBER) 
    UNION ALL
    SELECT  rownum LINENUM,
            a.wip_entity_id LINE_ID,
            a.INVENTORY_ITEM_ID INVITMID,
            a.QUANTITY_ISSUED PICKQTY      
      FROM  WIP_REQUIREMENT_OPERATIONS a,
            eam_work_orders_v b
      WHERE a.wip_entity_id=b.wip_entity_id
         AND 'on'=:2
        AND a.ATTRIBUTE2=NVL(:4,a.ATTRIBUTE2)
      and b.wip_entity_name=NVL(:6,b.wip_entity_name)
    I need to pass dynamically a condition to my where clause that i can handle it by defining two bind parameters in the vo query and can pass it but the problem is the bind variable contains a string like 1311,13112,14445 that i need to pass for a field such as B.line_id in the first query and b.wip_entity_id in the second query so when i am trying by passing the string as one value it is working fine but for value separetd by comma it is giving prob.
    so i tried by passing dynamic where clause but it is everytime executing for first clause only how i can pass dynamically both the queries.
    vo.setWhereClause("LINE_ID in "+wherclause);
    please help me out
    Thnaks
    Deb

    Hi Gaurav,
    Thnaks for the reply i tried belwo way u suggested but the query is executing multiple times and i am not getting the correct data as expected.
    public void processPOData (String wherclause)
                 OAViewObject vo = this.getXXDPECONTAINLINESVO1();
                    String query =vo.getQuery();
                    String newwhereclause ="LINE_ID = "+wherclause;
                    StringBuffer stringbuffer = new StringBuffer();  
                stringbuffer.append("SELECT * FROM (");
                stringbuffer.append(query);
                stringbuffer.append(") where ");
                stringbuffer.append(newwhereclause);          
        ViewDefImpl viewdefimpl = getXXDPECONTAINLINESVO1().getViewDefinition();
                viewdefimpl.setQuery(stringbuffer.toString());
                 vo.reset();
                 vo.clearCache();
                vo.executeQuery();
                    System.out.println("where clause:"+wherclause);
    in my log file the query is forming like below:
    SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM ( SELECT * FROM ( SELECT  rownum LINENUM,
            B.line_id LINE_ID,
            B.INVENTORY_ITEM_ID INVITMID ,
            B.QUANTITY_DELIVERED PICKQTY ,
            B.TO_SUBINVENTORY_CODE UNLOADINGPNT,
            A.REQUEST_NUMBER RRNUM,
            NULL WORKORDNUM,
            NULL DTRNUM,
            A.description,
            A.FROM_SUBINVENTORY_CODE FROM_SUB,
            A.TO_SUBINVENTORY_CODE  TO_SUB,
            NULL SOURCE       
    from   MTL_TXN_REQUEST_HEADERS A,
            MTL_TXN_REQUEST_LINES  B
      WHERE A.HEADER_ID=B.HEADER_ID
       AND A.MOVE_ORDER_TYPE=2  
    UNION ALL
    SELECT  rownum LINENUM,
            a.wip_entity_id LINE_ID,
            a.INVENTORY_ITEM_ID INVITMID,
            a.QUANTITY_ISSUED PICKQTY,
            a.ATTRIBUTE2 UNLOADINGPNT,
            NULL RRNUM,
            b.WIP_ENTITY_NAME WORKORDNUM,
            NULL DTRNUM,
            b.description,
            NULL FROM_SUB,
            NULL TO_SUB,      
            b.source SOURCE
      FROM  WIP_REQUIREMENT_OPERATIONS a,
            eam_work_orders_v b
      WHERE a.wip_entity_id=b.wip_entity_id ) )) where LINE_ID = 30026) where LINE_ID = 30026) where LINE_ID = 30026
    But in my page i am getting all the data instead of only for line 30026, please help me out

  • How to set two Conditions Simultaneously in set where clause

    Hi,
    I have a messgechoice item , and i need to fire messagechoice VO with two conditions.
    For Eg:-- we have three Items ProjectContractor& Work Order on a custom Page , now i need work order list should populate on lelection of project & contractor both, so i have apply a fire partial event on contractor where i i get the parameter values as follows:--
    CO Code
    if("OrderNoself".equals(event))
    String value21 = (String)pageContext.getParameter("ProjectName");
    System.out.println("The Selected Project Name for self Contractor is "+value21);
    String value22 = (String)pageContext.getParameter("ContractorName");
    System.out.println("The SelectedContractor Name for ContractorName is "+value22);
    Serializable [] params11 = {value21,value22} ;
    am.invokeMethod("initWorkOrderNumberself",params11);
    AM Code
    public void initWorkOrderNumberself(String ProjectName,String ContractorName");
    getDprWorkOrderpopVO1().setWhereClause("PROJECT_NAME = " + "'"+ProjectName+"'");
    getDprWorkOrderpopVO1().setWhereClause("CONTRACTOR_NAME = " + "'"+ContractorName+"'");
    getDprWorkOrderpopVO1().executeQuery();
    Now when i run my form then Work order list only populateon set conditions ofContractor NAme only.
    Please suggest....

    Hi Tarun,
    Thanx for ur reply,
    i have used below mwntioned code provided by you but still i m getting error...
    public void initWorkOrderNumber(String ProjectName,String ContractorName)
    //getDprWorkOrderpopVO1().setWhereClause("CONTRACTOR_NAME = " + "'"+ContractorName+"'");
    //getDprWorkOrderpopVO1().executeQuery();
    getDprWorkOrderpopVO1().setWhereClause("PROJECT_NAME =:1 AND CONTRACTOR_NAME=:2");
    getDprWorkOrderpopVO1().setWhereClauseParams(null);
    getDprWorkOrderpopVO1().setWhereClauseParam(1,ProjectName);
    getDprWorkOrderpopVO1().setWhereClauseParam(2,ContractorName);
    getDprWorkOrderpopVO1().executeQuery();
    ERROR:---
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (select * from omaxe_work_order_headers
    where work_order_number is not null) QRSLT WHERE (PROJECT_NAME =:1 AND CONTRACTOR_NAME=:2)
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
         at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:862)
         at oracle.apps.fnd.framework.OAException.wrapperInvocationTargetException(OAException.java:985)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:210)
         at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:152)
         at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:721)
         at omaxe.oracle.apps.xxopa.boqmain.webui.OmaxeDPRCO.processFormRequest(OmaxeDPRCO.java:107)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
         at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
         at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
         at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
         at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
         at OA.jspService(OA.jsp:40)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
         at java.lang.Thread.run(Thread.java:534)
    ## Detail 0 ##
    java.sql.SQLException: ORA-01006: bind variable does not exist
    Regards
    Saurabh

  • How to set a page parameter using javascript ?

    Hi:
    i'd like to set page parameter with a value taken from a textbox when clicking a button using javascript code.
    i mean, i have a textbox and a button using javascript and i want to take the value from the textbox and when onClick event happens set that value to the page parameter. How can i do this????
    Thanks.
    Best regards. Urko.

    Hi,
    Can you please elaborate your requirement. May be some better ways can be suggested. Also please mention which component you are using.
    Thanks,
    Sharmila

Maybe you are looking for

  • How Do I Burn a Music Disc with Files Names Included?

    Hi, Is it possible to burn a music disc and somehow include the file names so when it is opened in another iTunes (or mine) it will have the track listing there? Thanks! James [email protected]

  • DAX - Grouping by 2 different fields in 1

    Hi, Imagine a table that has persons. Persons have a set of attributes like Father and Mother profession. In each of the fields, the contents are on the same context, you can have a person that has a father or mother that is a doctor, engineer or tea

  • Video Stream Protection, what version to buy

    Hi All! I need to stream video files but verify that the user requesting the video has been approved to access it. My idea is to use some sort of signature based authentication (ie: that the url passed to the media server has some data that the serve

  • F9 functionality from Magic Mouse?

    Recently upgraded from a Mighty Mouse to a Magic Mouse. I love it mostly, but I miss the one-handed "side button" equivalent to F9 functionality. Is there a special gesture on the Magic Mouse I could enable to do the same thing?

  • Need Advice on CPU :)

    I bought the MSI(6585)-648MAX(HT-Ready)  in April this year, now i m currently using a 1.5(Willamette).My MB I want to upgrade to a 3ghz... Now I was wondering, it says under the CPU support page that i can get a Pentium 4 Northwood 3.06G, but i was