Use SQL REPLACE in View Criteria
Hi,
I'm using JDev 11.2.3.0.
I have created a View Criteria to restrict on email address and need to strip off the '@domain.com' part of the bind variable. In SQL I would just use REPLACE to do this, but cannot find a way to add that keyword in the View Criteria dialogue.
Do I need to modify the Bind variable using EL? If so, how do I refer to the bind variable itself in the bind variable expression?
Many thanks.
You can't just use EL without permanently changing the input of the user (e.g. using a converter to strip away the '@domain.com' part).
You need to overwrite the prepareRowSetForQuery method in the VO you are using to make the query. In this method you can alter the bind variable before the query executes.
//In view object implementation
public void prepareRowSetForQuery(ViewRowSetImpl vrs) {
//Set the value for bind variable ':bindVarDeptId' only for default row set
if(vrs.isDefaultRowSet()){
vrs.setNamedWhereClauseParam( "bindVarDeptId", getUserDeptId());
super.prepareRowSetForQuery(vrs);
}Timo
Similar Messages
-
Using Max Function in View Criteria
Hi
I am having a requirement where by i need to make use of max function in view criteria but not able to see any such option. Can someone please help me over it. Here is the requirement.
In table i will be having multiple rows for an employee and i need to pick latest row based on a column say request_id For e.g.
Emp RequestId
A 1
A 2
A 3
A 4
So if i pass the employee id i should get Row Number 4. In simple SQL language I want something like this
select * from emp where empid=A and requestid=( select max(requestid) from emp where empid=A)
Just wanted to know is there any approach that i can use to do all this as part of View Criteria or any other way.
Any help is appreciated!!!
Thanks
AJOne way is this -
1)https://blogs.oracle.com/adf/entry/using_groovy_aggregate_functions_in (You might need to create a self-referencing VL for this , try if it works using a ViewAccessor too)
OR
Order by RequestId descending in your SQL for the VO if thats ok , then have the ViewCriteria for the EmpId and programmatically pickup the first row... -
How to use BETWEEN operator in View Criteria
Hello Champs,
I want to query some data based on date range Value for e.g From "21-JUN-06 " TO "21-JUL-06"
How can I do this using the ViewCriteria
ViewCriteria vc = vo.createViewCriteria();
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
vcRow.setAttribute(attrName," BETWEEN " + "'" + fromDateValue + "'" + " AND '" + ToDateValue + "'");
vc.addElement(vcRow);
vo.applyViewCriteria(vc);
vo.executeQuery();
does not seems to work, no errors either
thank you all in advanceThanks, Timo,
I was passing invalid date format
it was looking for yyyy-mm-dd
and passed value was 2006/05/05 so, / does matter;
select * from EMP WHERE TO_CHAR(EMP_JOIN_DATE,'yyyy-mm-dd') BETWEEN '2006-05-05' AND '2006-06-30'; will work
select * from EMP WHERE TO_CHAR(EMP_JOIN_DATE,'yyyy-mm-dd') BETWEEN '2006/05/05' AND '2006/06/30'; will not work -
Using SYSDATE in Pre-Defined View Criteria ADF BC
I’m trying to setup a View Criteria to find records between two dates. So I create a View Criteria and Select my date field from the table and then choose the “Between” operator and then my operand is a Bind Variable. Then in my Bind variables I have SYSDATE and SYSDATE-7. So in my view.xml I have the following:
<Variable
Name="SystemDate"
Kind="viewcriteria"
Type="java.sql.Date">
<TransientExpression><![CDATA[SYSDATE]]></TransientExpression>
</Variable>
<Variable
Name="Bind_SystemDateMinusSeven"
Kind="viewcriteria"
Type="java.sql.Date">
<TransientExpression><![CDATA[SYSDATE-7]]></TransientExpression>
</Variable>
However, when I try to run this View Criteria (using on an af:query component), I get the following error.
Messages for this page are listed below.
Error
Unexpected exception caught: java.lang.reflect.UndeclaredThrowableException, msg=null
Error
Name SYSDATE not found in the given object: ViewRow [oracle.jbo.Key[877 ]
Does anyone know how to do this using ADF BC and View Criterias? I've tried making my bind variables Strings and this doesn't work either. I basically want a predefined query that finds records within a specific week given the system date. Any ideas on how to make this work? Thanks.You can achieve SYSDATE in ADF BC View Criteria using IsSqlFragment="true".
Below is the VO source code snippet for the same.
<ViewCriteriaItemValue
Name="ViewObjCriteria_ViewObjSubCriteria1_vcrow40_HireDate_vcval0"
Value="sysdate-350" IsSqlFragment="true"/>
<ViewCriteriaItemValue
Name="ViewObjCriteria_ViewObjSubCriteria1_vcrow40_HireDate_vcval1"
Value="sysdate" IsSqlFragment="true"/>
</ViewCriteriaItem> -
Using IN keyword in an sql query in a view criteria
Hi,
I am using jdev 11.1.1.1.0 and defined an lov query/viewobject as
select a, b, c from myTable
I now need to predefine filtering for lov search functionality and need something like the following
select a, B, c from myTable where B in ('X','Y')
I could not find a way to do it (i.e. specify the use of IN Keyword) in the Create View Criteria dialog box. I tried to define OR, but is that the best way to redefine IN as i have a long list (the above is just an example)
(( ( (UPPER(B_FLAG) = UPPER('X') ) ) OR ( (UPPER(DISPLAY_FLAG) = UPPER('Y') ) ) ))If you know how many variables are in your "in" You can just write this in the sql query of your VO:
http://www.oracle.com/technology/obe/obe11jdev/ps1/ria_application/images/t136.gif
From this tutorial:
http://www.oracle.com/technology/obe/obe11jdev/ps1/ria_application/developriaapplication_long.htm#ah1 -
Named View Criteria with no wizard - I write the SQL
Using JDeveloper/ADF 11.1.2.3.
Is there a way to create a named View Criteria with a SQL Select that is more complex than the wizard can write?
I know that I can write code to create a View Criteria at runtime, but then I can't just drag and drop it like a named one.
One use case:
I have a table named FACILITIES, with a detail table named FACILITY_SERVICES. I want a view criteria for FACILITIES that finds all facilities that have all the required services in a bind variable that is a comma delimited list.
WHERE list.to_vc_array(:requiredServices) /* I wrote this function to translate a comma delimited list to my own vc_arraytype. */
SUBMULTISET OF
CAST(MULTISET ( SELECT service
FROM facility_services
WHERE facilities.facility_id = facility_services.facility_id)
AS vc_arraytype)With the wizard, I can't even write a simple IN query (match at least one of the required services), much less this more complex one (match ALL the required services).I'm not sure that this is so bad :)
You need to implement one interface and override one method.
For example:
public class YourVOImpl extends ViewObjectImpl implements ViewCriteriaAdapter {
protected void create() {
super.create();
setViewCriteriaAdapter(this);
@Override
public String getViewCriteriaClause(ViewObject viewObject, ViewCriteria viewCriteria) {
if (viewCriteria == null || viewCriteria.size() == 0) return null;
return "list.to_vc_array(:requiredServices)\n" +
" SUBMULTISET OF \n" +
" CAST(MULTISET ( SELECT service\n" +
" FROM facility_services\n" +
" WHERE facilities.facility_id = facility_services.facility_id)\n" +
" AS vc_arraytype)");
}Dario -
How to view alerlog contents using SQL?
How to view alertlog contents using SQL?
Hi,
Why don't you use the OEM Database Console ?? Now, in order to view the contents of the alert log file using a SELECT statement, you need to create a external table:
create or replace
directory background_dump_dest_dir
as '<your_oracle_home>/bdump';
CREATE table alert_log_external
(line varchar2(4000) )
ORGANIZATION EXTERNAL
(TYPE oracle_loader
DEFAULT DIRECTORY background_dump_dest_dir
ACCESS PARAMETERS (
RECORDS DELIMITED BY newline
nobadfile
nologfile
nodiscardfile
FIELDS TERMINATED BY '#$~=ui$X'
MISSING FIELD VALUES ARE NULL
(line)
LOCATION ('alert_<sid_of your_database>.log') )
REJECT LIMIT UNLIMITED;Cheers -
How can I use a single query panel with two view criteria?
Hi all,
I have a requirement to allow users to change the "display mode" on a search results tree table for an advanced search page. What this will do is change the structure of how the data is laid out. In one case the tree table is 3 levels deep, in the other case it's only 2 with different data being at the root node.
What I've done so far:
1) I exposed the data relationship for these two ways of viewing the data in the application module's data model.
2) I created a view criteria in the two view objects that are at the root of the relationships, where (for simplicity sake) I'm only comparing a single field.
This is in one view object:
<ViewCriteria
Name="PartsVOCriteria"
ViewObjectName="gov.nasa.jpl.ocio.qars.model.views.PartsVO"
Conjunction="AND">
<Properties>... </Properties>
<ViewCriteriaRow
Name="vcrow23"
UpperColumns="1">
<ViewCriteriaItem
Name="PartDiscrepantItemsWithIRVO"
ViewAttribute="PartDiscrepantItemsWithIRVO"
Operator="EXISTS"
Conjunction="AND"
IsNestedCriteria="true"
Required="Optional">
<ViewCriteria
Name="PartDiscrepantItemsWithIRVONestedCriteria"
ViewObjectName="gov.nasa.jpl.ocio.qars.model.views.PartDiscrepantItemsWithIRVO"
Conjunction="AND">
<ViewCriteriaRow
Name="vcrow26"
UpperColumns="1">
<ViewCriteriaItem
Name="InspectionRecordNumber"
ViewAttribute="InspectionRecordNumber"
Operator="="
Conjunction="AND"
Value=""
Required="Optional"/>
</ViewCriteriaRow>
</ViewCriteria>
</ViewCriteriaItem>
</ViewCriteriaRow>
</ViewCriteria>
and this is in the other view object:
<ViewCriteria
Name="IRSearchCriteria"
ViewObjectName="gov.nasa.jpl.ocio.qars.model.views.InspectionRecordVO"
Conjunction="AND">
<Properties>... </Properties>
<ViewCriteriaRow
Name="vcrow7"
UpperColumns="1">
<ViewCriteriaItem
Name="InspectionRecordNumber"
ViewAttribute="InspectionRecordNumber"
Operator="="
Conjunction="AND"
Required="Optional"/>
</ViewCriteriaRow>
</ViewCriteria>
3) I had a query panel and tree table auto-generated by dragging the data control for ONE of the view object data relationship that's exposed in the app module. Then I created a second query panel and tree table the same way but using the data control for the other. I'm hiding one of the query panels permanently and toggling the visibility of the tree tables based on the display mode the user chooses. Both tables have separate bindings and iterators.
This is a portion of the page definition:
<executables>
<variableIterator id="variables"/>
<searchRegion Criteria="IRSearchCriteria"
Customizer="oracle.jbo.uicli.binding.JUSearchBindingCustomizer"
Binds="InspectionRecordVOIterator"
id="IRSearchCriteriaQuery"/>
<iterator Binds="InspectionRecordVO" RangeSize="25"
DataControl="QARS_AppModuleDataControl"
id="InspectionRecordVOIterator" ChangeEventPolicy="ppr"/>
<iterator Binds="Root.QARS_AppModule.PartsVO1"
DataControl="QarsMasterAppModuleDataControl" RangeSize="25"
id="PartsVO1Iterator"/>
<searchRegion Criteria="PartsVOCriteria"
Customizer="oracle.jbo.uicli.binding.JUSearchBindingCustomizer"
Binds="PartsVO1Iterator" id="PartsVOCriteriaQuery"/>
</executables>
4) I've created a custom queryListener to delegate the query event.
This is in my advanced search jsp page:
<af:query id="qryId1" headerText="Search" disclosed="true"
value="#{bindings.IRSearchCriteriaQuery.queryDescriptor}"
model="#{bindings.IRSearchCriteriaQuery.queryModel}"
queryListener="#{pageFlowScope.SearchBean.doSearch}"
queryOperationListener="#{bindings.IRSearchCriteriaQuery.processQueryOperation}"
resultComponentId="::resId2" maxColumns="1"
displayMode="compact" type="stretch"/>
This is in my backing bean:
public void doSearch(QueryEvent queryEvent) {
String bindingName = flag
? "#{bindings.IRSearchCriteriaQuery.processQuery}"
: "#{bindings.PartsVOCriteriaQuery.processQuery}";
invokeMethodExpression(bindingName, queryEvent);
private void invokeMethodExpression(String expr, QueryEvent queryEvent) {
FacesContext fctx = FacesContext.getCurrentInstance();
ELContext elContext = fctx.getELContext();
ExpressionFactory eFactory = fctx.getApplication().getExpressionFactory();
MethodExpression mexpr =
eFactory.createMethodExpression(elContext, expr, Object.class, new Class[] { QueryEvent.class });
mexpr.invoke(elContext, new Object[] { queryEvent });
When no inspection record number (the only search field so far) is supplied in the query panel, then it behaves correctly. Namely, the tree tables shows all search results. However, when an inspection record number is supplied the tree table that was created with the query panel in use (remember there are two query panels, one of them is hidden) shows a single result (this is correct) while the other tree table (the one with the hidden query panel that isn't in use) shows all results (this is NOT correct).
Is what I'm trying to accomplish even doable? If so, what am I missing?
I'm using JDeveloper 11.1.1.7
Thanks,
BillI ended up keeping one query panel permanently visible and the other permanently hidden. When performing a search using the table that has the hidden query panel, I seed the query descriptor for the hidden query panel using the visible query panel's query descriptor and then delegate the request:
public void doSearch(QueryEvent queryEvent) {
String bindingName = null;
if(isIrTableRendered()) {
bindingName = "#{bindings.IRSearchCriteriaQuery.processQuery}";
} else {
seedPartsQueryDescriptor();
bindingName = "#{bindings.PartsVOCriteriaQuery.processQuery}";
queryEvent = new QueryEvent(partsQuery, partsQuery.getValue());
invokeMethodExpression(bindingName, queryEvent);
private void seedPartsQueryDescriptor() {
ConjunctionCriterion criterion = irQuery.getValue().getConjunctionCriterion();
for(Criterion criteria : criterion.getCriterionList()) {
AttributeCriterion attributeCriteria = (AttributeCriterion)criteria;
List values = attributeCriteria.getValues();
String qualifiedName = attributeCriteria.getAttribute().getName();
int indexOfDot = qualifiedName.lastIndexOf(".");
String name = indexOfDot < 0
? qualifiedName
: qualifiedName.substring(indexOfDot + 1);
ConjunctionCriterion partsCriterion =
partsQuery.getValue().getConjunctionCriterion();
for (Criterion partsCriteria : partsCriterion.getCriterionList()) {
AttributeCriterion partsAttributeCriteria =
(AttributeCriterion) partsCriteria;
String partsQualifiedName =
partsAttributeCriteria.getAttribute().getName();
if (partsQualifiedName.endsWith(name)) {
partsAttributeCriteria.setOperator(attributeCriteria.getOperator());
List partsValues = partsAttributeCriteria.getValues();
partsValues.clear();
for (int i = 0, count = values.size(); i < count; i++) {
partsValues.set(i, values.get(i));
private void invokeMethodExpression(String expr, QueryEvent queryEvent) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
MethodExpression methodExpression =
expressionFactory.createMethodExpression(elContext, expr, Object.class, new Class[] { QueryEvent.class });
methodExpression.invoke(elContext, new Object[] { queryEvent });
Then when the advanced/basic button is pressed for the visible query panel, I programmatically set the same mode for the hidden query panel:
public void handleQueryModeChange(QueryOperationEvent queryOperationEvent) {
if(queryOperationEvent.getOperation() == QueryOperationEvent.Operation.MODE_CHANGE) {
QueryMode queryMode = (QueryMode) irQuery.getValue().getUIHints().get(QueryDescriptor.UIHINT_MODE);
QueryDescriptor queryDescriptor = partsQuery.getValue();
queryDescriptor.changeMode(queryMode);
AdfFacesContext.getCurrentInstance().addPartialTarget(partsQuery); -
Hi. I'm new to adf and my english is poor so be patient with me, thanks in advance for that.
To build a serch form based on a view that was configured to use a bind variable I simply drop the Executewithparams operation and build a adf parameters form.
There is any way to do the same think (or something like this) with a view criteria. I tried to put an instance of the view and customize it with a view criteria that used a bind-variable in the application model. But using Executewithparams didn't work and I don't know what method I should call ?Thanks for the answer, you are right I already tried this, but I wanted an input box + a button because the idea is: If the search returns only one result then you get a result page directly, but if there are many results then you get a page to choose one of them. I did this with a task-flow: one view for the search-panel then a router and a view for the choose-one-page (I haven't got time to test it completely but it seems to work).
There is a way to do this with the quick query component ?
Thanks [email protected] -
How to use arrays in view criteria
Hi all,
Am using Oracle Jdeveloper ,Studio Edition Version 11.1.1.2.0.
I have a query panel with three comboxes,which can multiselect
company,application & user respectively.When I mutiselect company,
then based on the selected value I need to populate the application
& user comboboxes.I want to search based on the selection.
I have used viewcriteria to filter the apllication&
user comboboxes.When a company is selected then company_id is passed as
bind variable to the view criteria,then it can filter application combobox.
Its working fine on single selection.
So I want to pass the selected values as an array to view criteria.
Please help
Thankscn u chk this..
http://jobinesh.blogspot.com/2010/12/using-oraclejbodomainarray-with.html
oops.. i am late by three minutes.. ;)
you can check the link provided.. above -
Error ORA-06502 When using function REPLACE in PL/SQL
Hi,
I have a PL/SQL procedure which gives error 'Error ORA-06502 When using function REPLACE in PL/SQL' when the string value is quite long (I noticed this with a string 9K in length)
variable var_a is of type CLOB
and the assignment statement where it gives the error is
var_a := REPLACE(var_a, '^', ''',''');
Can anyone please help!
ThanksEven then that shouldn't do so:
SQL> select overload, position, argument_name, data_type, in_out
2 from all_arguments
3 where package_name = 'STANDARD'
4 and object_name = 'LPAD'
5 order by 1,2
6 /
OVERLOAD POSITION ARGUMENT_NAME DATA_TYPE IN_OUT
1 0 VARCHAR2 OUT
1 1 STR1 VARCHAR2 IN
1 2 LEN BINARY_INTEGER IN
1 3 PAD VARCHAR2 IN
2 0 VARCHAR2 OUT
2 1 STR1 VARCHAR2 IN
2 2 LEN BINARY_INTEGER IN
3 0 CLOB OUT
3 1 STR1 CLOB IN
3 2 LEN NUMBER IN
3 3 PAD CLOB IN
4 0 CLOB OUT
4 1 STR1 CLOB IN
4 2 LEN NUMBER INI wonder what happened? -
Label of attribute when used as View Criteria item with Bind Variable
I've a VO attribute used in a named search with this requirement:
The attribute provides has an optional View Criteria item that has a bind variable operand. The bind variable is in the WHERE clause. The attribute has an LOV. The choice list for the specified View Criteria item should display the label "Effective Release". However, in all other contexts, including the search results table and the dropdowns the user can optionally add in an advanced search, the label displayed for the attribute must say "Release".
In other words, the default label for the attribute should be "Release" in all but one context - which is that when the dropdown list for the viewCriteria item using the bind variable is displayed, the label should say "Effective Release".
Note that if the user moves to Advanced Search and selects adds the attribute as a search criteria, this latter usage should be labeled as "Release". (in this case, in other words, the dropdown that displays by default and has the bind variable operand is labelled "Effective Release", the one the user added in advance search is labelled "Release")
here is the View Criteria item source xml:
<ViewCriteriaItem
Name="ReleaseId1"
ViewAttribute="ReleaseId1"
Operator="="
Conjunction="AND"
Value=":v_ReleaseId"
GenerateIsNullClauseForBindVars="false"
ValidateBindVars="true"
IsBindVarValue="true"
Required="Required"/>I've experimented by putting "Effective Release" as the label for the bind variable as below. However, ADF does not use that value to display, it defers to the attribute value:
<Variable
Name="v_ReleaseId"
Kind="viewcriteria"
Type="oracle.jbo.domain.Number">
<Properties>
<SchemaBasedProperties>
<LABEL
ResId="EFFECTIVE_RELEASE_LOV"/>
</SchemaBasedProperties>
</Properties>
</Variable>The reason for the requirement, if it matters, is that the View Criteria item with the bind variable ("Effective Release" queries a range of values using the analytic function rank(); the bind variable is in the WHERE clause. Otherwise, the dropdown that can be added in advanced search ("Release") looks for exact matches on the attribute value. So since the search functionality is different, the label should be different.
Am using 11g.
Thanks for your help.Hi
I have found that when using validation type Key Exists and the VO is in the local application, then the bind variable is available in the Create Validation wizard. When I try and create a validator on a VO that is core to all my applications, then I put that VO into an ADF library, the bind variable parameter is not available for mapping to my entity object attribute, even though I can select the VO to create a view accessor from the ADF library.
Possible bug? -
Oracle.jbo.NoDefException: Error in Quick Search when we use View Criteria
We encountered NoDefException error in Quick Search. We are using JDeveloper 11.1.1.6.0, JHeadstart 11.1.1.4
I am able to reproduce the error by applying Oracle's HR schema. The following are the steps to reproduce with HR schema:
1. Create an employee view named EmpVw by using the following query:
select
employee_id,
first_name,
last_name,
email,
phone_number,
salary
from employees
2. Create a lookup view named CountryLookupView by using the following query:
select
country_id,
country_name
from countries
3. Create a view named EmpCountryVw by using the following query:
select
emp.employee_id,
emp.first_name,
emp.last_name,
cnty.country_id,
cnty.country_name
from employees emp
inner join departments dept
on emp.department_id = dept.department_id
inner join locations loc
on dept.location_id = loc.location_id
inner join countries cnty
on loc.country_id = cnty.country_id
4. Create a LOV for the CountryId attribute in EmpCountryVw. The data source for this LOV is the CountryLookupView we just created. UI hints list type is Input Text with List of Values.
5. Create View Criteria for EmpVw view, name it as EmpVwSearchCriteria Select EmpCountryVw from Attribute list, Operator is Exists, Operand is Inline View Criteria.
6. Create new service EmployeeSearchService. Select EmpVw to the data model.
7. In JHeadStart Application Definition Editor, create a new service node EmloyeeSearchService, set EmpVwSearchCriteria as Quick Search View Criteria in Search Settings section. Run the JAG, and then run the application.
8. On the application screen, select EmployeeSearchService from the module drop-down list, on Emp Vw screen, click the glass icon to display the pop-up country search dialog, type in CA as country code, run the search, select the row with "Ca Canada" and then click OK button to close off the pop-up dialog. on Emp Vw screen, click "->" to run the search with Country Id = CA. Note the error dialog popup.
The error message is: oracle.jbo.NoDefException: JBO-25058
Caused by: oracle.jbo.NoDefException: JBO-25058: Definition data_MyJhsTutorial_UIShellPageDef_mainRegion_oracle_hr_pageDefs_EmpVwPageDef_WEB_INF_adfc_config_EmpVw_xml_EmpVwTaskFlow_EmpVwIteratorEmpVwSearchCriteriaQuery.vcrow125.EmpCountryVw.EmpCountryVwNestedCriteria.vcrow128.CountryId of type Attribute is not found in EmpVw.
at oracle.jbo.server.ViewObjectImpl.findAttributeDef(ViewObjectImpl.java:7310)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._isTransientAttribute(FacesCtrlSearchBinding.java:585)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._changeQueryModeIfNeeded(FacesCtrlSearchBinding.java:577)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:397)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
... 63 more
Please let me know if you have solution for this error. Thanks in advance.
SarahSarah,
I could reproduce the error.
However, I created a drag-and-drop page fragment with quick search and table, and modified the adfc-config-EmpVw task flow to reference the drag and drop page:
<view id="EmpVwTable">
<page id="__120">/EmpvwDD.jsff</page>
</view>
And then I still get the same error, so this looks like an ADF bug to me.
I also created a stand-alone jspx page using drag and drop, same error as well. I suggest you make a testcase without JHeadstart and contact Oracle Support.
Steven Davelaar,
JHeadstart Team. -
Problem occured when create a tree table for master-detail view objects using SQL queries?
I am programming a tree table for master-detail view objects using SQL queries and these 2 view objects are not simple singel tables queries, and 2 complex SQL are prepared for master and view objects. see below:
1. Master View object (key attribute is SourceBlock and some varaible bindings are used for this view object.)
SELECT cntr_list.SOURCE_BLOCK,
sum(
case when cntr_list.cntr_size_q = '20'
then cntr_list.cntr_qty
else 0 end ) as cntr20 ,
sum(
case when cntr_list.cntr_size_q = '40'
then cntr_list.cntr_qty
else 0 end ) as cntr40 ,
sum(
case when cntr_list.cntr_size_q = '45'
then cntr_list.cntr_qty
else 0 end ) as cntr45
FROM (
SELECT yb1.BLOCK_M as SOURCE_BLOCK,
scn.CNTR_SIZE_Q,
count(scn.CNTR_SIZE_Q) AS cntr_qty
FROM SHIFT_CMR scm, SHIFT_CNTR scn, YARD_BLOCK yb1, YARD_BLOCK yb2
WHERE
scm.cmr_n = scn.cmr_n
AND (scm.plan_start_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS')
OR scm.plan_end_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS'))
AND scm.shift_mode_c = :ShiftModeCode
AND scm.end_terminal_c = :TerminalCode
AND scm.start_terminal_c = yb1.terminal_c
AND scm.start_block_n = yb1.block_n
AND substr(scn.start_location_c,(instr(scn.start_location_c,',',1,5)+1),instr(scn.start_location_c,',',1,6)-(instr(scn.start_location_c,',',1,5)+1)) BETWEEN yb1.slot_from_n AND yb1.slot_to_n
AND scm.end_terminal_c = yb2.terminal_c
AND scm.end_block_n = yb2.block_n
AND substr(scn.end_location_c,(instr(scn.end_location_c,',',1,5)+1),instr(scn.end_location_c,',',1,6)-(instr(scn.end_location_c,',',1,5)+1)) BETWEEN yb2.slot_from_n AND yb2.slot_to_n
AND scn.status_c not in (1, 11)
AND scn.shift_type_c = 'V'
AND scn.source_c = 'S'
GROUP BY yb1.BLOCK_M, scn.CNTR_SIZE_Q
) cntr_list
GROUP BY cntr_list.SOURCE_BLOCK
2. Detail View object (key attributes are SourceBlock and EndBlock and same varaible bindings are used for this view object.)
SELECT cntr_list.SOURCE_BLOCK, cntr_list.END_BLOCK,
sum(
case when cntr_list.cntr_size_q = '20'
then cntr_list.cntr_qty
else 0 end ) as cntr20 ,
sum(
case when cntr_list.cntr_size_q = '40'
then cntr_list.cntr_qty
else 0 end ) as cntr40 ,
sum(
case when cntr_list.cntr_size_q = '45'
then cntr_list.cntr_qty
else 0 end ) as cntr45
FROM (
SELECT yb1.BLOCK_M as SOURCE_BLOCK,
yb2.BLOCK_M as END_BLOCK,
scn.CNTR_SIZE_Q,
count(scn.CNTR_SIZE_Q) AS cntr_qty
FROM SHIFT_CMR scm, SHIFT_CNTR scn, YARD_BLOCK yb1, YARD_BLOCK yb2
WHERE
scm.cmr_n = scn.cmr_n
AND (scm.plan_start_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS')
OR scm.plan_end_dt BETWEEN to_date(:DateFrom,'YYYY/MM/DD HH24:MI:SS') AND to_date(:DateTo,'YYYY/MM/DD HH24:MI:SS'))
AND scm.shift_mode_c = :ShiftModeCode
AND scm.end_terminal_c = :TerminalCode
AND scm.start_terminal_c = yb1.terminal_c
AND scm.start_block_n = yb1.block_n
AND substr(scn.start_location_c,(instr(scn.start_location_c,',',1,5)+1),instr(scn.start_location_c,',',1,6)-(instr(scn.start_location_c,',',1,5)+1)) BETWEEN yb1.slot_from_n AND yb1.slot_to_n
AND scm.end_terminal_c = yb2.terminal_c
AND scm.end_block_n = yb2.block_n
AND substr(scn.end_location_c,(instr(scn.end_location_c,',',1,5)+1),instr(scn.end_location_c,',',1,6)-(instr(scn.end_location_c,',',1,5)+1)) BETWEEN yb2.slot_from_n AND yb2.slot_to_n
AND scn.status_c not in (1, 11)
AND scn.shift_type_c = 'V'
AND scn.source_c = 'S'
GROUP BY yb1.BLOCK_M, yb2.BLOCK_M, scn.CNTR_SIZE_Q
) cntr_list
GROUP BY cntr_list.SOURCE_BLOCK, cntr_list.END_BLOCK
3. I create a view link to create master-detail relationship for these 2 view objects.
masterview.SourceBlock (1)->detailview.SourceBlock (*).
4. I create a tree table using these 2 view objects with master-detail relationship.
When I set default value for variable bindings of these 2 view objects and the matching records exist, tree table can work well. I can expand the master row to display detail row in UI.
But I need to pass in dymamic parameter value for variable bindings of these 2 view objects, tree table cannnot work again. when I expand the master row and no detail row are displayed in UI.
I am sure that I pass in correct parameter value for master/detail view objects and matching records exist.
Managed Bean:
DCIteratorBinding dc = (DCIteratorBinding)evaluteEL("#{bindings.MasterView1Iterator}");
ViewObject vo = dc.getViewObject();
System.out.println("Before MasterView1Iterator vo.getEstimatedRowCount()="+ vo.getEstimatedRowCount());
System.out.println("Before MasterView1Iterator ShiftModeCode="+ vo.ensureVariableManager().getVariableValue("ShiftModeCode"));
vo.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
vo.ensureVariableManager().setVariableValue("DateTo", dateTo);
vo.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
vo.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
vo.executeQuery();
System.out.println("MasterView1Iterator vo.getEstimatedRowCount()="+ vo.getEstimatedRowCount());
DCIteratorBinding dc1 = (DCIteratorBinding)evaluteEL("#{bindings.DetailView1Iterator}");
ViewObject vo1 = dc1.getViewObject();
System.out.println("Before DetailView1Iterator vo1.getEstimatedRowCount()="+ vo1.getEstimatedRowCount());
System.out.println("Before DetailView1Iterator ShiftModeCode="+ vo1.ensureVariableManager().getVariableValue("ShiftModeCode"));
vo1.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
vo1.ensureVariableManager().setVariableValue("DateTo", dateTo);
vo1.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
vo1.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
vo1.executeQuery();
System.out.println("after DetailView1Iterator vo1.getEstimatedRowCount()="+ vo1.getEstimatedRowCount());
5. What's wrong in my implementation? I don't have no problem to implement such a tree table if using simple master-detail tables view object, but now I have to use such 2 view objects using complex SQL for my requirement and variable bindings are necessary for detail view object although I also think a bit strange by myself.Hi Frank,
Thank you and it can work.
public void setLowHighSalaryRangeForDetailEmployeesAccessorViewObject(Number lowSalary,
Number highSalary) {
Row r = getCurrentRow();
if (r != null) {
RowSet rs = (RowSet)r.getAttribute("EmpView");
if (rs != null) {
ViewObject accessorVO = rs.getViewObject();
accessorVO.setNamedWhereClauseParam("LowSalary", lowSalary);
accessorVO.setNamedWhereClauseParam("HighSalary", highSalary);
executeQuery();
but I have a quesiton in this way. in code snippet, it is first getting current row of current master VO to determine if update variables value of detail VO. in my case, current row is possibly null after executeQuery() of master VO and I have to change current row manually like below.
any idea?
DCIteratorBinding dc = (DCIteratorBinding)ADFUtil.evaluateEL("#{bindings.SSForecastSourceBlockView1Iterator}");
ViewObject vo = dc.getViewObject();
vo.ensureVariableManager().setVariableValue("DateFrom", dateFrom);
vo.ensureVariableManager().setVariableValue("DateTo", dateTo);
vo.ensureVariableManager().setVariableValue("ShiftModeCode", shiftModeC);
vo.ensureVariableManager().setVariableValue("TerminalCode", terminalCode);
vo.executeQuery();
vo.setCurrentRowAtRangeIndex(0);
((SSForecastSourceBlockViewImpl)vo).synchornizeAccessorVOVariableValues(); -
Passing two values in two different views using view criteria in adf bc
I have two tables. Message and MessageProperties. Message table is connected with itself as same as Employee table of HR. Means a Message can have various child message. MessageProperties contains the message properties. A message can have various properties. I want to show the message only if it has a particular value in MessageProperties,then its properties,its child message. If its child message have the same value in MessageProperties,then it shows that. Likewise it should give me a tree structure with its all properties.
When I am hardcode the value then its shows fine.
SELECT Message.MESSAGE_ID,
Message.MSG_CONTENT_ID,
FROM MESSAGE Message, MESSAGE_PROP MessageProp
WHERE (MessageProp.Message_Id=Message.Message_Id) AND ((MessageProp.Key='From' OR MessageProp.Key='To') AND (MessageProp.value='B'))
But when I use the Bind variable in view criteria then I am not able to achieve this.
1. How to do that in adf bc and how to link message and messageprop with this condition?
2. How to pass two parameters in serviceinterface FIndViewCriteria method i.e. messageId and value so that it will show only that message having that value?Thanks Timo,
It helps me a little bit.
It only shows me the parent message id and its properties. But it is not showing its child message id and its properties.
Let me explain you step by step what I have done.
1> I have created a view MessageView with two entities i.e Message and MessageProp and include the value attribute of MessageProp in it.
2> I have created the default MessagePropView from MessageProp Entity.
3> In MessageView I have modified the query which you have given.
4> I have created the Bind variables.
5> I have created a view criteria and in that view criteria I have included Message_Id=:Bind_MessageId and Value=:Bind_Value.
6> I have created an association connecting Message.Message_Id and Message.Parent_Id(1 to * cardinality) because a message can be a parent of many messages.
7> I have created a viewlink between Message and MessageProp using Message_Id.
8> I have created a view link between Message and Message using the association which I have created in step 6.
9> I have created the Application Module. In that,my Data Model looks like
---MessagePropView2
---MessageView1
---------MessagePropView1
---------MessageView2
10> Then I have created the service interface. In service interface view instances,I include these two view and select the GetByKey operation from basic operations.
11> From View Criteria find operations I have included the view criteria which I have created in message view in step 5.
12> Then I run the AppModuleServiceImpl.java and select the view criteria operation which I have created in step 11.
13> There I find two bind variables i.e. Bind_MessageId and Bind_Value. I give the values there.
But it checks whether that message Id(Bind_MessageId) which I have given have that value(Bind_Value) or not. If it has then it shows only that message along with its properties but it is not showing me its childs and their properties.
I want to show only those child message who have the MessageProp.value as (Bind_Value).
I hope you understand with the scenario.
I'll be very thankfull to you if you help me to do this.
Rohit.
Maybe you are looking for
-
How can I get an old Casio CTK-593 to work with Logic Express?
Title pretty much says it all. I have a Fast Track USB from M-Audio to connect it to my pc but I don't know how to get it working with Logic. Thanks in advance.
-
FMLE 3.2 and 3.1 can't detect an audio device with Windows 8.1
FMLE 3.2 and 3.1 can't detect an audio device with Windows 8.1 x64 on an MSI GT72-2QD laptop. I tried 2 different webcams but the result was the same. Both the internal mic and the ones going with the webcams work fine with other software but when I
-
Can't initiate factory restore
The sound card on my recently-inherited Toshiba satellite L655D-S5050 has been malfunctioning so I want to try to repair it via factory restore, except I can't find/access the factory image. Seriously, I've tried everything. The boot menu, the setu
-
In gmail there is a provision to type in Devanagari (Hindi or Marathi) but this does not work when I'm in Firefox 10.0.1 If I use Google Chrome browser there is no problem
-
I am not een sure how it was installed in the first place. Do I need it? Is it necessary for me to be able to use Flash? I don't have Acrobat on my system. I am getting a pop up every few hours on my computer. It says: "this application requires a v