Not able to set the where clause params
Hi,
My version of apps is 12.1.3.
I created a page with a searchRN and resultRN (LinesVO). (Not a query/view link) . I am passing the id from header to the VO to restrict the linesVO
The controller correctly passes the id from searchRN to AM, but in AM, the where clause is not set and I am not getting the desired result:
My AM Code:
public void InvokeGo(String Hdrval)
LineVOImpl LineVO1 = getLineVO1();
LineVO1.setWhereClauseParams(null); // Always reset
System.out.println("AMIMPL:Hdrval = "+ Hdrval);
<prints the header_Value which is passed from CO>
if (Hdrval == null
System.out.println("Inside Null If");
String message = "Please provide atleast one input to any of these search field";
throw new OAException(message, OAException.ERROR);
else
System.out.println("Not All Parameters are Null.Building Where Clause");
< prints the line above>
LineVO1.setWhereClause
("Header_name = :1");
System.out.println("Paremeter Set are: Header_name:"+Hdrval);
<prints the above line like : Paremeter Set are: Header_name:Hdr_Name_1
LineVO1.setWhereClauseParam(0,Hdrval);
System.out.println("Inside MainAM invokeGO Method:"+LineVO1.getQuery());
< prints:Inside MainAM invokeGO Method:SELECT * FROM (select LINE_ID,hdr.HEADER_ID,LINE_NUMBER,LINE_NAME,Attach,hdr.header_name from xxtr_hdr hdr, xxtr_line line
where hdr.header_id=line.header_id) QRSLT WHERE (Header_name = :1)>
LineVO1.executeQuery();
The issue is in the SQL build. I guess after setting the where clause, it should appear like :
QRSLT WHERE (Header_name = "Hdr_Name_1"
Thanks
Hu Sumit,
I am doing that:
LineVO1.setWhereClauseParam(0,Hdrval);
before executequery. I even hard coded
LineVO1.setWhereClauseParam(0,"XXXX");
but still it din't work. I guess I am missing something small. because I have done this thing a lot of times earlier and it had worked.
Similar Messages
-
JSP, DataWebBean: How to dynamically set the where clause of query and display record
Hi,
I am reposting this question as per suggestions made by Mr. Dwight.
I have used ViewCurrentRecord web bean to display records from EMP table. I have to use the Dept_Id_FK from the current
record of the EMP table to display corresponding records of Dept table. I have a view object called DeptView in my Business
Components which selects all the records from the Dept table.
How do I get the value of Dept_Id_FK and use it to display the required records of the Dept table?
I tried to declare a variable and get the value of Dept_Id_FK but it did not work. My code is as follows:
<%! String m_DeptId = null; %>
<jsp:useBean id="RowViewer" class="oracle.jbo.html.databeans.ViewCurrentRecord" scope="request">
<%
RowViewer.initialize(pageContext, "EMPApp_EMP_EMPAppModule.EMPView1");
RowViewer.setReleaseApplicationResources(false);
RowViewer.getRowSet().next();
m_DeptId = (String)RowViewer.getRowSet().getCurrentRow().getAttribute("DeptIdFk");
%>
</jsp:useBean>
Thanks.
nullFirst of all, Thank you very much for making use of the new topic format. It is very much appreciated.
As for your question, I think there are several different ways to accomplish what I think you want to do.
1. Create a view object that includes both Emp and Dept entities and join them there. In this case, your query would look something like this:
Select e.empno,e.name,...,d.dname,d.loc from emp e, dept d
where e.deptno = d.deptno
You should be able to create a JSP off of this view object that contains both the employee and department information. In this case, BC4J takes care of the foreign key to primary key coordination.
2. In order to set a dynamic where clause for a view, you need to do the following in your usebean tag:
rsn.initialize(application,session, request,response,out,"DeptView");
rsn.getRowSet().getViewObject().setWhereClause("deptno=" | | m_DeptId);
rsn.getRowSet().getViewObject().executeQuery();
rsn.getRowSet().first();
You will need to do this in a separate usebean tag from the EmpView, since the usebean can only initialize one view object.
In other words, you would have your ViewCurrentRecord bean tag for the EmpView, then a separate one for the DeptView where you use the above code to set the where clause to display just the information for the department you want.
Another option, but one I'm not sure would work as well, is to create a master-detail JSP to do this for you. Usually a master-detail is a one-to-many (one department to many employees). Your request appears to be the reverse, but might still be doable using the same mechanism.
You set up relationships between views in your BC4J project using View Links. If you used the BC4J project wizard and created default views, some of these links may have been created for you. They are created when BC4J detects a foreign key to primary key relationship in the database.
You can create your own View Links using the View Link wizard. Select your BC4J project node and choose Create View Link... from the context menu. You will be asked to select a source view (Emp), and a target view (Dept), then select the attribute in each view that related the two of them (deptno).
Next, you need to reflect this new relationship setting in your application module. Select your app module and choose Edit from the context menu. On the data model page, select the EmpView node in the Selected list. Now select the DeptView node in the available list and shuttle it over. You should see DeptView1 via yourlink appear indented under the EmpView node. Save and rebuild your BC4J project to reflect the changes.
In your JSP project, you can now have the wizard create a master-detail form for you based on DeptView1.
Let me know if the above answers your question, or if I have misunderstood what it is you wanted to do.
null -
JSP, Data Web Bean, BC4J: Setting the where clause of a View Object at run time
Hi,
I am trying to develop a data web bean in which the where clause of a View Object will be set at run time and the results of the query then displayed.
My BC4J components are located in one project while the coding for the data web bean is in another project. I used the following code bu t it does not work. Could you please let me know what I am doing wrong?
public void populateOSTable(int P_EmpId)
String m_whereString = "EmpView.EMP_ID = " + P_EmpId;
String m_OrderBy = "EmpView.EMP_NAME";
oracle.jbo.ApplicationModule appModule = null;
ViewObject vo = appModule.findApplicationModule("EMPBC.EMPAppModule").findViewObject("EMPBC.EMPView");
vo.setWhereClause(m_whereString);
vo.setOrderByClause(m_OrderBy);
vo.executeQuery();
vo.next();
String empName numAttrs = vo.getAttribute(EmpName);
System.out.println(empName);
Thanks.<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JDev Team (Laura):
Here is how I have usually done mine:
1. In the JSP, use a RowsetNavigator bean to set the where clause and execute the query.
2. Use a custom web bean to process the results of the query (print to HTML).
for example:
<jsp:useBean class="oracle.jbo.html.databeans.RowsetNavigator" id="rsn" scope="request" >
<%
// get the parameter from the find form
String p = request.getParameter("p");
String s = request.getParameter("s");
// store the information for reference later
session.putValue("p", p);
session.putValue("s", s);
// initialize the app module and view object
rsn.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
// set the where clause string
String theclause = "presname = '" + p + "' AND slideno=" + s;
// set the where clause for the VO
rsn.getRowSet().getViewObject().setWhereClause(theclause);
rsn.getRowSet().getViewObject().executeQuery();
rsn.getRowSet().first();
%>
</jsp:useBean>
<jsp:useBean class="wt_bc.walkthruBean" id="wtb" scope="request" >
<%
// initialize the app module and VO
wtb.initialize(application,session, request,response,out,"wt_bc_WT_bcModule.wtjoinView");
wtb.render();
%>
In this case, the render method of my custom web bean mostly gets some session variables, and prints various content depending on the session variable values.
Hope this helps.
</jsp:useBean><HR></BLOCKQUOTE>
Laura can you give the code of your walkthru bean? i wna't to initialize a viewobject, set the where clause and give that viewobject back to initialize my navigatorbar.
Nathalie
null -
Not able to set the variable to the variant in dynamic selections
HI,
I got a ticket related to variant. The variant is created to the report and logical database is added in the attributes of the report so that we can have the option to choose the dynamic slections. Variables are created in TVARVC table. I am able to set the variable by pressing F4 in dynamic selections to the variant. When i save and comeback, i am not able to see the variables in the dynamic selections. I can save the variables in static selections and it is working fine. Pleas help me i need this urgently.Hi,
maybe sth wrong with the passing of parameters in the value help of the affected field.... Pls check.
BTW: do u pay us for solving your customer tickets? (-;
Cheers,
André -
How to set the where clause of a value set on the basis of a form field
I am using a DFF(Descriptive FlexField), which needs to display the value of a certain column(say columnA) on the basis of the value of another column(say columnB).
So i have created a value set which points to the table which has both these columns, and the DFF uses this value set. However, the problem is that I have not put any where clause in the value set, because of which i cannot handle the exact fetch returns more than one rows error.
The query has to be as follows:
select ColumnA from tbl where ColumnB = [ a form value ];
What I want to know is how can i get the value of a certain field of a certain block of the form in the above query.
Edited by: 981615 on Jan 14, 2013 12:48 AM
Edited by: 981615 on Jan 14, 2013 12:48 AMJust have a look over these two statements if it solves your problem
one time where clause
Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,your form item);
dynamic where clause
set_block_property('BLOCK_NAME'default_where, your form itme)
you can where clause at run time from any procedure or some triggers -
Hi All,
I am not able set the context to an xml file in JFPREAMBLE CONTEXT file. Can any suggest me how to fix it?context.setAttribute("myTest", "mkmmkmmkm");
String output = (String) getServletContext().getAttribute("testMe");You set "myTest" but try to get "testMe" -
Not able to set the SMTP timeout session on BIPublisherAPI
Any of the below parameters are not taking into effect:
deliveryRequest.addProperty(DeliveryPropertyDefinitions.ASYNC_CHECK_INTERVAL,
"1");
deliveryRequest.addProperty(DeliveryPropertyDefinitions.ASYNC_TIMEOUT,
"1");
deliveryRequest.addProperty(CommonPropertyDefinitions.TIMEOUT,
"1");
Is there any workaround to set the time out on the smtp session using BI publisher java api?Sorry, what I said was rubbish, because the LSMW and the session run in different external sessions.
I have searched forum for these terms: "company BUK parameter BDC background"
These threads Is it possible to set default company code in SM35? and Release BDC in SM35 in background, How to set defaul company code? seem promising, but I'm not sure they really solve.
In case these threads don't help you, I think you can create your own Z transaction which sets the BUK parameter id and then does a LEAVE TO TRANSACTION 'ABAON'. Then create again the recording on the Z transaction.
If you are using ECC6, then you may also enhance the standard to reset BUK parameter id at the very beginning of ABAON, in case it's run in batch input (sy-binpt = 'X'). Be careful as sometimes SAP does batch input on some transactions, so that could make the standard fail.
Last thing, you can contact SAP support, though it might probably be considered as consulting. -
Not able to set the value in marketing context node for BP_HEAD
Hi,
I am trying to set the value in marketing node of BP_HEAD from bp_addr component. i am calling the set_property method but it is not changing the value, when i debugg the code, it actually changing the value in bol structure but it is not calling the get/set method of bp head.
i am working on BP corporate person creation i.e. in bp_head component and account details view. I added the marketing attributes in UI configuration and also the address attributes.
this is what i coded in get method of country in standardaddress context node of BP_ADDR
lv_entity ?= current.
IF lv_entity IS BOUND.
lv_parent = lv_entity->get_parent( ).
IF lv_parent IS BOUND.
lv_entity_mkt = lv_parent->get_related_entity( iv_relation_name = 'BuilMarketingRel' ).
IF lv_entity_mkt IS BOUND.
CALL METHOD lv_entity_mkt->set_property
EXPORTING
iv_attr_name = 'ATTRIBUTE'
iv_value = attribute1.
Can anyone please guide me on how to set the value cross component and can we call the get/set method of that attribute which is not in same component?
Regards,
Kamesh BathlaSorry, what I said was rubbish, because the LSMW and the session run in different external sessions.
I have searched forum for these terms: "company BUK parameter BDC background"
These threads Is it possible to set default company code in SM35? and Release BDC in SM35 in background, How to set defaul company code? seem promising, but I'm not sure they really solve.
In case these threads don't help you, I think you can create your own Z transaction which sets the BUK parameter id and then does a LEAVE TO TRANSACTION 'ABAON'. Then create again the recording on the Z transaction.
If you are using ECC6, then you may also enhance the standard to reset BUK parameter id at the very beginning of ABAON, in case it's run in batch input (sy-binpt = 'X'). Be careful as sometimes SAP does batch input on some transactions, so that could make the standard fail.
Last thing, you can contact SAP support, though it might probably be considered as consulting. -
Programmatically setting UI Hints for runtime named where clause params
Hi,
At runtime, I've added some named where clause parameters to my view object instance, set the where clause and then executed the query. Then, when navigating to the target page, where a af:query panel is shown and a af:table shows the filtered results, I see the bind variables I've just created appearing in the search area as mandatory fields.
My question is: how can I hide those runtime bind variables?
Thanks
JDeveloper 11.1.1.3.0I do want where clauses to be created at runtime instead of design time to improve DB performance
whereClause += "AND DEPARTMENT_ID = " + departmentId;Marge -
What you are doing is a recipe for POOR performance, not good performance. String concatenation in a where clause with no bind variables... ugh! Poor performance + poor security (you are now susceptible to SQL injection attacks).
I suggest that you do this at design time (where possible) and have a read of the documentation about view criteria.
And please, no matter what approach you use, PLEASE PLEASE PLEASE start using bind variables and not just jamming strings together to make your where clause, otherwise you are heading straight for disaster. I cannot stress this enough.
John -
How to set dynamic WHERE clause to VO from backingBean?
Hi,
Can any one let me know the best way to add the dynamic WHERE clause in to VO query.
I have created AM (with AMImpl.java) & VO (with VOImpl.java & VORowImpl.java) in my model project. I suppose to set the WHERE condition at runtime while the user click the search button. I am handling the user button click at UI layer backingBean. From the backing bean I could able to get the objct of the VO and set the where clause by below code.
ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{bindings.UserSearchVO1Iterator}", Object.class);
DCIteratorBinding dcIter = (DCIteratorBinding)valueExp.getValue(elContext);
ViewObject userSearchVO = dcIter.getViewObject();
userSearchVO.setWhereClause("lower(usr_login) LIKE ':1' and usr_udf_suid like ':2' ");
userSearchVO.executeQuery();But as I fear this is not the right way to do it. So I am creating the cutom method inside the VOImpl.java and triggring that method by creating one more cutom method in AMImpl.java. But I dont know how to invoke this AM method from backingBean.
AMImpl method
public void initDetails()
UserSearchVOImpl vo = getUserSearchVO1();
vo.initQuery();
VOImpl method
public void initQuery()
setWhereClause("lower(usr_login) LIKE 'a%' and usr_udf_suid like '%1144%'");
executeQuery();
}Can any one guide me which is the best way to set the where clause to VO? How to call the AM method from backingBean?
Thanks
klni am new to oracle 11g i writing a stored procedure in which i have made use of case in where clause to pass my parameter value v_toStoreID
i have googled a lot regarding that i found that to use case in where clause it should be like this
where
case column_value
when 0
then value1
else
value2
end
this my query
SELECT ITMID as ItemId,
NVL(OrderDtl.PackageID, 0) PackageId,
OrderDtl.OrdDtlID,
(CASE NVL(OrderDtl.PackageID, 0)
WHEN 0
THEN 1
ELSE 0
END) as PackageFlag,
ivitem.Code ItemCode,
ivitem.ITMNAME AS itemName,
IvPatientIssueMst.IssueNo Issue_No,
to_char(Issuedate, 'DD/MM/YYYY') IssueDate,
OrderDtl.OrdQty,
NVL(OrderDtl.AllocationID, 0) Package,
OrderDtl.ServiceAmount MRP
FROM IvPatientIssueMst
JOIN OrderMst
ON IvPatientIssueMst.OrderId = OrderMst.OrdId
JOIN OrderDtl
ON OrderDtl.OrdID = OrderMst.OrdId
JOIN ivitem
ON ivitem.ITMID = OrderDtl.DrugId
LEFT JOIN IVPatientIndentMst
ON IVPatientIndentMst.IndentID = IvPatientIssueMst.IndentId
WHERE OrderMst.OrdVisitID = 395899
AND
*(CASE IvPatientIssueMst.StoreId*
when NVL(IvPatientIssueMst.StoreId, 0)=0
THEN v_toStoreID
ELSE IVPatientIndentMst.ToStoreID
END)
ORDER BY ivitem.ITMNAME;
it is not working please someone help -
Dynamically set ViewObject where clause dynamically from Java bean
I have a requirement to display all of the records from a table when the JSP is first brought up, so my View Object looks like this:
"select emp_name from emp"
Then the users wants to ability to pass paramters to that View Object to refine the list so from by Java class I tried to do this:
ViewObject vo = cpd.findViewObject("EmpViewObject");
vo.setWhereClause("empName = :1");
vo.setWhereClauseParam(1,varEmpName);
vo.executeQuery();
But I am getting JBO errors and I'm not sure what I'm doing wrong. Can anyone offer a hint as to how I can do this?this is exactly how the code is done -
1. emp_name in the View Object
2. emp_name in the where clause
The two are identical. I have tried many variations of this - any time I set the where clause from my bean I get an error.
When I take the SQL stmnt and run it in TOAD it returns expected rows when I run it in the SQL worksheet in JDev it gives an invalid Identifier - but if I hard code the where clause in the View Object it returns the same results as TOAD. -
How to set dynamic where clause in ADF?
Hi,
I have a View object called BillInfoVO. This has
all the information about who created the request, the time , status etc.,
I need to display this VO in a jsp. But before I display, i need to fileter this
VO results with different where clauses according to the role of the user.
For example, if the role is admin, then
where clause should be 'status = 'Completed, and created by = 'Current user'
If the role is requestor, then
the where clause should be
sales manager id = 'Current user' and
Status != Complete etc.,
Could any one please let me know how I can
dynamically set the where clause to filter the appropirate
result row set in the jsp?
Your help will be greatly appreciated.
Thanks,
venkiYou'll create a service method in your AM that will use the setWhereClause method of a viewobject.
Then you'll expose it as a client method.
Then you'll drag it from your data-control onto a button in your JSF page that will call your page for the query.
More about service methods here:
http://download.oracle.com/docs/html/B25947_01/bcservices003.htm#sm0206
http://download.oracle.com/docs/html/B25947_01/bcquerying008.htm#sthref286 -
I am not able to set high and low limits for each channel seperately using LabWindows/CVI
I am using AI_StartAcquisition and AI_ReadAcquisition functions to acquire data using PCI 6025E DAQ card and iam using Lab/Wuindows/CVi5.0 software. But one of my transducer has its range in +/- 500 mV soi need to set the high low limits of each channel seperately for that i am using commond string function(cmd) but still i am not able to set the limits properly. Does anyone has any idea about this trouble
You can set the gain on a per channel basis by using the lower level functions. (As opposed to the easy i/o functions.) For example, look at the "SCANsingleBufSync.C" NI-DAQ shipping example that uses the SCAN_Op() function. It's gain parameter is an array of gains that will allow you to change the input limits for each channel separately.
-Russell -
I am using an external keyboard which is actually a Device KeyAT who do the keyboard simulator kind of operation over Serial (RS232) to USB connector.
I have a controller machine connected with Serial Port and MAC machine is connected by a USB port to that device.
I am able to type the password on OS X login screen but on using the same device and set up on Filevault preboot I am not able to type the password.
This connector is detected as a USB 2.0 composite device in System Hardware table.
Can someone hints or point out a potential cause or to rectify this issue.
Thanks in Advance.Which os version are you using?
Which iPod Nano model do you have? iPod Models
iPod not recognized in iTunes and Mac desktop -
I am trying to set up my newly purchased Apple TV but when I enter my network password while setting up, I am not able to enter the Submit button, any idea how to hit the visible submit button that is visible on screen but not responding?
You need to use the right arrow on the remote to go all the way to the right. The submit button will be highlighted and you can then press select on the remote to proceed.
Maybe you are looking for
-
Dump run time error "dbif_rsql_sql_error"
Hi guru's, I have a genric data source with function module which feeds data to a genric ods in bw. But at time of data upload i see quality status in manage of ods green saying (0 of 0 records extracted) but it asks me to check dump in st22 which is
-
Two coc villages in one game center account -- how do i get rid of the new one?
I badly need your help guys. Im frustrated already with this problem on my coc. Here is the situation. I already have a coc account on my iphone 4g, then i signed in my game center account on my aunt's ipad and downloaded coc, thinking it would autom
-
How I can see the data of my message after processing?
Hi guys, My scenario is XI -> R/3 (asynchronous) using ABAP Proxy. When a try to send a message the flag code is ok and the message enters in R/3 inbound queue, so it means that everything ok! I want to know how I can see my data in queue or better h
-
I just installed Firefox 4 today. When I try to change the keyword.url settings in about:config to do a "I'm Felling Lucky" Google search, it just resets to chrome://browser-region/locale/region.properties whenever I restart Firefox.
-
Programmatically add steps to a VI
I am writing a code to control a bank of valves via cDAQ/DAQmx. I need to figure out how to allow the user to build a macro or something similar that will allow them to programmatically change the order and number of the steps in a sequence. For exa