Filtering a sharepoint 2010 list using Multiple values from Multi-Select Filtering In Infopath 2010 form
I am creating a browser based InfoPath 2010 form Calendar Filtering
using SharePoint 2010 Calendar List (All Events) and InfoPath 2010. This form has data connection to the Calendar list. Goal is to
compare Calendar Events from Current Year to Previous Year. I have 2 columns called - Previous Year and Current Year. I have 2 drop-down controls in each columns called
Select Year and Select Week. I also have common drop down called
Select Category which holds category of the events such as weather, power outages and so on. I wish to display specific events on specific date and specific week on both columns.
I am able to filter the list based upon Year and Week
on both these columns by applying rules in the InfoPath 2010 form. The real issue is that I want to apply category filter on the search result of
Year and Week. Or it needs to show all the values if I
select Category value as All. So I wish to apply filter on Search results using Category drop-down list selection.
Hope I could explain this better but I tried to do the best here. Any suggestions, hint, or pointers
Thanks
Snehal H Rana
Thanks Snehal H.Rana SharePoint Consultant
I am creating a browser based InfoPath 2010 form Calendar Filtering
using SharePoint 2010 Calendar List (All Events) and InfoPath 2010. This form has data connection to the Calendar list. Goal is to
compare Calendar Events from Current Year to Previous Year. I have 2 columns called - Previous Year and Current Year. I have 2 drop-down controls in each columns called
Select Year and Select Week. I also have common drop down called
Select Category which holds category of the events such as weather, power outages and so on. I wish to display specific events on specific date and specific week on both columns.
I am able to filter the list based upon Year and Week
on both these columns by applying rules in the InfoPath 2010 form. The real issue is that I want to apply category filter on the search result of
Year and Week. Or it needs to show all the values if I
select Category value as All. So I wish to apply filter on Search results using Category drop-down list selection.
Hope I could explain this better but I tried to do the best here. Any suggestions, hint, or pointers
Thanks
Snehal H Rana
Thanks Snehal H.Rana SharePoint Consultant
Similar Messages
-
Passing Multiple Values from Multi Select
Hi,
My requirement is simple. I have created a simple Multi Select Option in parameter form and i want to send multiple selected values from the multi select option (in parameter form) to reports.
eg:
I want to send multiple countries code as input .........'US', 'CA', 'IND', 'UK'
Can i do it in Oracle 6i reports, Thanks in Advance.
Regards,
AsgarHi Thanks Again,
For such a nice response. I got the Lexical Where condition properly running but still getting problems in catching the multiple values to be passed from form. just i will give u an insight of wat i have done:
SQL:
SELECT ALL FROM EMPLOYEES &cond_1* -- Working FIne
in my Html Parameter Form i have an Multi Select component (the Problem is here) it is not passing more than i value from the form once i am accessing it from web or running it in paper report. In paper report layout it is not allowing me to select more than one value. but in HTML it is allowing to select multiple values but at the server end (After Parameter Form Trigger) it is giving a single value not multiple values.
In PL/SQL when i checking the length of country_id i m getting it as one.
Here is my SQL code
srw.message(10, LENGTH(:country_id_1));
:cond_1 := 'where country_id = '''|| :country_id_1 ||'''';
This is passing the condition properly to SQL but only with single value but i want to pass multiple values
I am struck in this+_
WHERE CONTRY_COLUMN IN ('USA','UAE') -- This variable you have to pass from you form...
Here as you said you gave multiple selection in your parameter form to generate report. So before generation report just prepare variable like this as it is bold above.
and pass parameter through your runtime form to the report as you pass the normal parameter...liket this i gave you example...
ADD_PARAMETER(PARAMETER_LIST_NAME,'P_CONT_PARAM',TEXT_PARAMETER,vString);
Sorry for troubling you for a small thing but please help me to solve this issue.
Thanks Again............
Asgar. -
Show selected value from multi-selected parameter in crystal report
Dear Experts!
i would like to ask how to catch selected value from multi-selected parameter to show in report header section.
Thanks in advance.Hi Dara,
If this is a string prompt then you could simply create a formula with this code and place it on the report header:
Join({?Prompt name},", ")
-Abhilash -
Get all values from multi select in a servlet
Hello,
I have a multi <select> element in a HTML form and I need to retrieve the values of ALL selected options of this <select> element in a servlet.
HTML code snippet
<select name="elName" id="elName" multiple="multiple">
Servlet code snippet
response.setContentType("text/html");
PrintWriter out = null;
out = response.getWriter();
String output = "";
String[] str = request.getParameterValues("elName");
for(String s : str) {
output += s + ":";
output = output.substring(0, output.length()-1); // cut off last deliminator
out.println(output);But even when selecting multiple options, the returned text only ever contains the value of the first selected option in the <select>
What am I doing wrong? I'm fairly new to servlets
Edited by: Irish_Fred on Feb 4, 2010 12:43 PM
Edited by: Irish_Fred on Feb 4, 2010 12:44 PM
Edited by: Irish_Fred on Feb 4, 2010 2:14 PM
Edited by: Irish_Fred on Feb 4, 2010 2:26 PM
Edited by: Irish_Fred on Feb 4, 2010 2:26 PM
Edited by: Irish_Fred on Feb 4, 2010 2:32 PMI am using AJAX.
I will show you how I'm submitting the <select> values by showing you the flow of code:
This is the HTML code for the <select> tag and the button that sends the form data:
<form name="formMain" id="formMain" method="POST">
<input type="button" id="addOpts" name="addOpts" value="Add Options" style="width:auto; visibility:hidden" onClick="jsObj.addOptions('servletName', document.getElementById('elName'))">
<br>
<select name="elName" id="elName" multiple="multiple" size="1" onChange="jsObj.checkSelected()">
<option value="0"> - - - - - - - - - - - - - - - - </option>
</select>
</form>Note that the "visibility:hidden" part of the button style is set to "visible" when at least one option is selected
Note that "jsObj" relates to a java script object that has been created when the web app starts ( The .js file is included in the .jsp <head> tag )
The following code is taken from the file: "jsObj.js"
jsObj = new jsObj();
function jsObj() {
//=================================================
this.addOptions = function(url, elName) {
var theForm = document.getElementById('formMain');
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
url += this.buildQueryString(theForm.name);
xmlhttp.open("POST",url,true);
xmlhttp.send(null);
xmlhttp.onreadystatechange=function() {
if(xmlhttp.readyState==4) { // 4 = The request is complete
alert(xmlhttp.responseText);
//=================================================
this.buildQueryString = function(formName) {
var theForm = document.forms[formName];
var qs = '';
for (var i=0; i<theForm.elements.length; i++) {
if (theForm.elements.name!='') {
qs+=(qs=='')? '?' : '&';
qs+=theForm.elements[i].name+'='+escape(theForm.elements[i].value);
return qs;
//=================================================
}And this is a code snippet from the "servletName" servlet:public synchronized void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,IOException {
PrintWriter out = null;
try {
response.setContentType("text/html");
out = response.getWriter();
String output = "";
String[] values = request.getParameterValues("elName");
for(String s : values) {
output += s + ":";
output = output.substring(0, output.length()-1); // cut off last delimitor
out.println(output);
} catch (Exception e) {
}So anyway, everthing compiles / works, except for the fact that I'm only getting back the first selected <option> in the 'elName' <select> tag whenever I select multiple options
Edited by: Irish_Fred on Feb 7, 2010 10:53 AM -
Select multiple values in mult-select list
I have the following query as the source for a multi-select page item:
SELECT person.person_id
FROM person, pers_proj_task
WHERE pers_proj_task.person_id = person.person_id
AND pers_proj_task.project_id = :P3_PROJECT_ID
The query returns two records and the page item's session value is 4:3, but only the value 4 is highlighted in the mulit-select list. How can I get both values to be highlighted?Got it to work for a multi-select item by following Dimitri's post which uses a shuttle example. It was still only highlighting one value, but I tried Patrick Wolf's suggestion from the comments on Dimitri's post to put the pl/sql block in the source of the item rather than as a computation and it worked.
So I now have a multi-select list which has default values pulled from a LOV. The items that are highlighted by default are selected by using the following pl/sql block in the "source/value or expression" of the :P3_PERSON_ID multi-select item:
declare
person_list apex_application_global.vc_arr2;
i number := 1;
begin
for r in ( SELECT person.person_id
FROM person, pers_proj_task
WHERE pers_proj_task.person_id = person.person_id
AND pers_proj_task.project_id = :P3_PROJECT_ID)
loop
person_list(i) := r.person_id;
i := i + 1;
end loop;
return APEX_UTIL.TABLE_TO_STRING(person_list,':');
end;
Thanks to Amanda, ArtS, Dimitri and Patrick.
Jeremy -
I need some syntax help with reading some values from a selected row in an Access form.
My goal: to extract the data from 4 fields in a datasheet row and place them in another form.
My problem: I can only get the field values from the first row of the datasheet.
I have tried using the Form_Click event as the location for the code I've tried. This seems to be the right place, but apparently referring to the desired fields by their names with Me. in front just references the first record in the datasheet, not
the one I've selected.
Should I just read the source form's recordset using the Currentrecord value somehow? I could use some direction on that.
Thank you.
Marj WeirIt's generally considered good forum etiquette to post back a description of the solution which you've reached.
The normal control for a multi-valued field is a combo box rather than a text box, but unless it is necessary for you to use a multi-valued field, i.e. your database is interfacing with SharePoint in the very limited context in which this feature is necessary,
I'd advise that you model the many-to-many relationship type in the time-honoured way by means of a table which resolves the relationship type into two one-to-many relationship types, and use a subform to show the data. You can alternatively use a multi-select
list box or a text box which shows a value list. You'll find examples of all three methods in StudentCourses.zip in my public databases folder at:
https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
Ken Sheridan, Stafford, England -
Extracting values from multi select check boxes delimeted by ":"
A set of check boxes in an Apex form produces "V1:V2:V3" in the target field, these are the key fields from a dynamic selection lists based on a table that contains the key and value fields. Does anyone have a sample SQL fragment that will produce a record for each one of the values ?
FORM_TABLE
ID (1)
CB_TARGET (V1:V2:V4)
LIST_TABLE
KEY_F (V1),(V2),(V3),(V4) etc.
VALUE_F (Value 1), (Value 2), (Value 3), (Value 4 ...)
Even though there is only a single row in this example in the "FORM_TABLE", how can this be transformed to :
1, V1
1, V2
1, V4
Regards
HDoes anyone have a sample SQL fragment that will produce a record for each one of the values ?Does it have to be SQL? The simplest approach is probably PL/SQL, using the <tt>apex_util.string_to_table</tt> function.
For a purely SQL-based solution, use whatever string-to-row technique is appropriate to your situation. -
Hi All,
I would assume this is a common problem.
I am a having problems using filters on SharePoint 2013 Lists on a custom site page.
I am using the Filter (text, date, Choice) Web Parts, however due to the limitations of the filter web parts, I am also using Parameters and the Filters from within SharePoint designer. Using this method, I am able to search date ranges and partial
text on set columns. The problem is that I have to fill out all the filter fields in order to get any results. If a filter is left blank then the list should only filter on the other filters. Instead it no results are returned.
In addition, if I do set the filters, how do you reset the filters to show all records again?
ThanksThe only way I've figured out is to create a field that is always empty, e.g., a calculated text field, and use that field to "test" if the parameter is blank. Here's an example CAML query fragment:
<Or>
<Contains>
<FieldRef Name="WorkflowDocsDescription"/>
<Value Type="MultiLookup">{DocDescriptionTextFilterValue}</Value>
</Contains>
<Eq>
<FieldRef Name="Empty"/>
<Value Type="Text">{DocDescriptionTextFilterValue}</Value>
</Eq>
</Or>
This may not perform well in a large list, but perhaps an index on the Empty field would remedy.
GShore -
How to get multiple values from the list
I've a list of an item which I queried it from the database. I also created a button that will takes a selected items from the list when it was clicked. I used javabean to get the data from database.
<% // clicked on Select District Button
Vector vselectedDistrict = new Vector();
Vector vdistrictID = new Vector();
String tmpSelectDistrict = "";
tmpSelectDistrict = request.getParameter("bSelectDistrict");
if(tmpSelectDistrict != null)
// get multiple values from the list
String[] selectedDistrict = request.getParameterValues("usrTDistrict");
vselectedDistrict.clear();
vdistrictID.clear();
if((selectedDistrict != null) && (selectedDistrict.length != 0))
for(int i=0;i<selectedDistrict.length;i++)
vselectedDistrict.addElement(selectedDistrict);
vdistrictID = dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
for(int i=0;i<vdistrictID.size();i++)
out.println("district = " + selectedDistrict[i]); out.println("district ID= " + vdistrictID.get(i).toString());
%>
// get vdistrict from the database here......
<select name="usrTDistrict" size="5" multiple>
<% for(int i = 0; i< vdistrict.size(); i++)
%>
<option value="<%=vdistrict.get(i).toString()%>"><%=vdistrict.get(i).toString()%></option>
<%
%>
</select>
<input type="submit" name="bSelectDistrict" value="Select District">
Lets say the item that i selected from the list is 'Xplace' and I clicked on the Select District button,
what I got is this error message:
org.apache.jasper.JasperException: Unable to convert string 'Xplace' to class java.util.Vector for attribute usrTDistrict: java.lang.IllegalArgumentException: Property Editor not registered with the PropertyEditorManager
So where is going wrong and what the message means?. Any help very much appreciated. ThanksThese are just guesses that might hopefully steer you in directions you haven't looked in yet.
I presume you used triangle brackets (< >) to avoid having the Jive Forum think it was the "italics" tag?
Are you certain this: dbaseInfo.getcurrentDistrictID(nstate,vselectedDistrict);
expects a Vector as its second parameter? And returns a Vector?
I don't believe you've shown how you use the javabean, or its code? Perhaps it should be rewritten to accept an array of strings instead of a Vector? -
Select multiple values in report level filters
Hi All,
I have report level filters in my webi report and i would like to seect multiple values from each filters?
is there any work around for this? your help is highly appreciated.
Thanks,
AnnEdit your Report in WebI. From the left side select the last Input Control Tab.
Click on New. Click on the field for which you need this Filter and select Next.
You will see Input Controls avaialble foir Single Values. Scroll Down. There you will see the Checkbox, List Box etc available for Multiple values. Click on one of them and click Next and Finish. -
[UIX] How To: Return multiple values from a LOV
Hi gang
I've been receiving a number of queries via email on how to return multiple items from a LOV using UIX thanks to earlier posts of mine on OTN. I'm unfortunately aware my previous posts on this are not that clear thanks to the nature of the forums Q&A type approach. So I thought I'd write one clear post, and then direct any queries to it from now on to save me time.
Following is my solution to this problem. Please note it's just one method of many in skinning a cat. It's my understanding via chatting to Oracle employees that LOVs are to be changed in a future release of JDeveloper to be more like Oracle Forms LOVs, so my skinning skills may be rather bloody & crude very soon (already?).
I'll base my example on the hr schema supplied with the standard RDBMS install.
Say we have an UIX input-form screen to modify an employees record. The employees record has a department_id field and a fk to the departments table. Our requirement is to build a LOV for the department_id field such that we can link the employees record to any department_id in the database. In turn we want the department_name shown on the employees input form, so this must be returned via the LOV too.
To meet this requirement follow these steps:
1) In your ADF BC model project, create 2 EOs for employees and departments.
2) Also in your model, create 2 VOs for the same EOs.
3) Open your employees VO and create a new attribute DepartmentName. Check selected in query. In expressions type (SELECT dept.department_name FROM departments dept WHERE dept.department_id = employees.department_id). Check Updateable always.
4) Create a new empty UIX page in your ViewController project called editEmployees.uix.
5) From the data control palette, drag and drop EmployeesView1 as an input-form. Notice that the new field DepartmentName is also included in the input-form.
6) As the DepartmentName will be populated either from querying existing employees records, or via the LOV, disable the field as the user should not have the ability to edit it.
7) Select the DepartmentId field and delete it. In the UI Model window delete the DepartmentId binding.
8) From the data controls palette, drag and drop the DepartmentId field as a messageLovInput onto your page. Note in your application navigator a new UIX page lovWindow0.uix (or similar) has been created for you.
9) While the lovWindow0.uix is still in italics (before you save it), rename the file to departmentsLov.uix.
10) Back in your editEmployees.uix page, your messageLovInput source will look like the following:
<messageLovInput
model="${bindings.DepartmentId}"
id="${bindings.DepartmentId.path}"
destination="lovWindow0.uix"/>Change it to be:
<messageLovInput
model="${bindings.DepartmentId}"
id="DepartmentId"
destination="departmentsLov.uix"
partialRenderMode="multiple"
partialTargets="_uixState DepartmentName"/>11) Also change your DepartmentName source to look like the following:
<messageTextInput
id=DepartmentName
model="${bindings.DepartmentName}"
columns="10"
disabled="true"/>12) Open your departmentsLov.uix page.
13) In the data control palette, drag and drop the DepartmentId field of the DepartmentView1 as a LovTable into the Results area on your page.
14) Notice in the UI Model window that the 3 binding controls have been created for you, an iterator, a range and a binding for DepartmentId.
15) Right click on the DepartmentsLovUIModel node in the UI Model window, then create binding, display, and finally attribute. The attribute binding editor will pop up. In the select-an-iterator drop down select the DepartmentsView1Iterator. Now select DepartmentName in the attribute list and then the ok button.
16) Note in the UI Model you now have a new binding called DCDefaultControl. Select this, and in the property palette change the Id to DepartmentName.
17) View the LOV pages source, and change the lovUpdate event as follows:
<event name="lovSelect">
<compound>
<set value="${bindings.DepartmentId.inputValue}" target="${sessionScope}" property="MyAppDepartmentId" />
<set value="${bindings.DepartmentName.inputValue}" target="${sessionScope}" property="MyAppDepartmentName" />
</compound>
</event>18) Return to editEmployees.uix source, and modify the lovUpdate event to look as follows:
<event name="lovUpdate">
<compound>
<set value="${sessionScope.MyAppDepartmentId}" target="${bindings.DepartmentId}" property="inputValue"/>
<set value="${sessionScope.MyAppDepartmentName}" target="${bindings.DepartmentName}" property="inputValue"/>
</compound>
</event>Thats it. Now when you select a value in your LOV, it will return 2 (multiple!) values.
A couple things to note:
1) In the messageLovInput id field we dont use the .path notation. This is mechanism for returning 1 value from the LOV and is useless for us.
2) Again in the messageLovInput we supply _uixState as an entry in the partialTargets.
3) We are relying on partial-page-refresh functionality to update multiple items on the screen.
Im not going to take the time out to explain these 3 points, but its worthwhile you learning more about them, especially the last 2, as a separate exercise.
One other useful thing to do is, in your messageLovInput, include as a last entry in the partialTargets list MessageBox. In turn locate the messageBox control on your page (if any), and supply an id=MessageBox. This will allow the LOV to place any errors raised in the MessageBox and show them to the user.
I hope this works for you :)
Cheers,
CM.Thanks Chris,
It took me some time to find the information I needed, how to use return multiple values from a LOV popup window, then I found your post and all problems were solved. Its working perfectly, well, almost perfectly.
Im always fighting with ADF-UIX, it never does the thing that I expect it to do, I guess its because I have a hard time letting go of the total control you have as a developer and let the framework take care of a few things.
Anyway, I'm using your example to fill 5 fields at once, one of the fields being a messageChoice (a list with countries) with a LOV to a lookup table (id , country).
I return the countryId from the popup LOV window, that works great, but it doesn't set the correct value in my messageChoice . I think its because its using the CountryId for the listbox index.
So how can I select the correct value inside my messageChoice? Come to think of it, I dont realy think its LOV related...
Can someone help me out out here?
Kind regards
Ido -
How to select multiple values from a listbox
Hi,
I have a list box on my UI which is not allowing me to select multiple values
I want to use multi select list box .. When i go to source of UI component and change that to select many listbox my page is not rendering it is giving error
When i drag & drop the component i am unable to drop it as a multi select list box that option is not coming.
I am working on Jdev 11.1.1.3 and I am using ADF/BC components
How to select multiple values from a listbox ?
Thanks,Hi,
I want to use multi select list box .. When i go to source of UI component and change that to select many listbox my page is not rendering it is giving errorank
And what is the error ?
Frank -
How to return multiple values from dialog popup
hi all
I'm using ADF 10g. I have a requirement that I have to return multiple values from a dialog.
I have a page containing a table with a button which calls the dialog. The dialog contains a multi-select table where i want to select multiple records and add them to the table in the calling page.
In the backing bean of the calling page, I have the returnListener method.
I am thinking that I have to store the selected rows from dialog in an array and return that array to the returnListener...but I don't know how to go about it with the code.
Can someone help me out with it?
thanksHi Frank,
I'm trying to implement your suggestion but getting comfused.
AdfFacesContext.getCurrentInstance().returnFromDialog(null, hashMap) is called in ActionListener method, from what I understood.
ReturnListener method already calls it, so no need to call explicitly.
Okay here's what i'm doing.
command button launches the dialog on the calling page.
In the dialog page, there is a button "select", which when i click, closes the dialog and returns to calling page. I put a af:returnActionListener on this button, which logically should have a corresponding ReturnListener() in the calling page backing bean.
Now I have 3 questions:
1. do i have to use ActionListener or ReturnListener?
2. where do I create the hashMap? Is it in the backing bean of the dialog or in the one of calling page?
3. how do I retrieve the keys n values from hashmap?
please help! thanks
This is found in the backing bean of calling page:
package mu.gcc.dms.view.bean.backing;
import com.sun.java.util.collections.ArrayList;
import com.sun.java.util.collections.HashMap;
import com.sun.java.util.collections.List;
import java.io.IOException;
import java.util.Map;
import javax.faces.application.Application;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.faces.event.ActionEvent;
import mu.gcc.dms.model.services.DMSServiceImpl;
import mu.gcc.dms.model.views.SiteCompaniesImpl;
import mu.gcc.dms.model.views.SiteCompaniesRowImpl;
import mu.gcc.dms.model.views.lookup.LkpGlobalCompaniesImpl;
import mu.gcc.util.ADFUtils;
import mu.gcc.util.JSFUtils;
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.faces.context.AdfFacesContext;
import oracle.adf.view.faces.event.ReturnEvent;
import oracle.adf.view.faces.model.RowKeySet;
import oracle.binding.AttributeBinding;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
import oracle.jbo.AttributeDef;
import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.jbo.RowIterator;
import oracle.jbo.RowSetIterator;
import oracle.jbo.domain.Number;
import oracle.jbo.server.java.util.Iterator;
public class CompanyList {
private BindingContainer bindings;
private Map hashMap;
DMSServiceImpl service =(DMSServiceImpl)ADFUtils.getDataControlApplicationModule("DMSServiceDataControl");
SiteCompaniesImpl siteCompanyList = service.getSiteCompanies();
LkpGlobalCompaniesImpl globalCompanyList = service.getLkpGlobalCompanies();
public CompanyList() {
public BindingContainer getBindings() {
return this.bindings;
public void setBindings(BindingContainer bindings) {
this.bindings = bindings;
*public void setHashMap(Map hashMap) {*
*// hashMap = (Map)new HashMap();*
this.hashMap = hashMap;
*public Map getHashMap() {*
return hashMap;
public String searchCompanyButton_action() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding =
bindings.getOperationBinding("Execute");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
return null;
*public void addCompanyActionListener(ActionEvent actionEvent){*
AdfFacesContext.getCurrentInstance().returnFromDialog(null, hashMap);
public void addCompanyReturnListener(ReturnEvent returnEvent){
//how to get hashmap from here??
public String addCompanyButton_action() {
return "dialog:globalLovCompanies";
} -
XML parser for fatching multiple values from XML
Hi,
In my scenirio i have to facth multiple values from XML file and then set in to Table in webdynpro...
Fo example my xml has values like...
<xml>
<item>
<item1>
<quantity>
100
</quantity>
<price>
50
</price>
</item1>
<item2>
<quantity>
200
</quantity>
<price>
20
</price>
</item2>
<item3>
<quantity>
300
</quantity>
<price>
10
</price>
</item3>
</item>
</xml>
then i have to fcath those quantity and price and set in to table...
How to do taht in webdynpro and does any one have parser code for retriving multiple values...Hi,
1) You need to use JDOM parser.
2) The code for parsing XML using JDOM parser is readily available if you search on google.
3) You will have to check the attribute during every parsing and then if attribute is quantity you can fetch the corresponding tags.
4) Something similar to this:
org.jdom.Document document = parser.build(file);
org.jdom.Element rootElement = document.getRootElement();
org.jdom.Element childElement = rootElement.getChild("file");
Element xmlElement = childElement.getChild("item");
if (xmlElement != null) {
List itemElementsList = xmlElement.getChildren("item1");
if (itemElementsList != null) {
Iterator iterator3 = itemElementsList.iterator();
while (iterator3.hasNext()) {
//For each group get quantity
Element itemElement = (Element) iterator3.next();
List quantityElementsList =
itemElement.getChildren("quantity");
if (quantityElementsList != null) {
Iterator iterator2 =
quantityElementsList.iterator();
while (iterator2.hasNext()) {
// Your code
You might need to make some changes as per your rquirement. Just use this sample to understand how you need to parse the xml
Hope it helps.
Regards.
Rajat
Edited by: Rajat Jain on Jan 22, 2009 9:51 AM -
Return multiple values from a function to a SELECT statement
I hope I've provided enough information here. If not, just let me know what I'm missing.
I am creating a view that will combine information from a few tables. Most of it is fairly straightforward, but there are a couple of columns in the view that I need to get by running a function within a package. Even this is fairly straightforward (I have a function named action_date in a package called rp, for instance, which I can use to return the date I need via SELECT rp.action_date(sequence_number).
Here's the issue: I actually need to return several bits of information from the same record (not just action_date, but also action_office, action_value, etc.) - a join of the tables won't work here as I'll explain below. I can, of course, run a separate function for each statement but that is obviously inefficient. Within the confines of the view select statement however, I'm not sure how to return each of the values I need.
For instance, right now, I have:
Table1:
sequence_number NUMBER(10),
name VARCHAR(30),
Table2:
Table1_seq NUMBER(10),
action_seq NUMBER(10),
action_date DATE,
action_office VARCHAR(3),
action_value VARCHAR(60),
I can't simply join Table1 and Table2 because I have to do some processing in order to determine which of the matching returned rows I actually need to select. So the package opens a cursor and processes each row until it finds the one that I need.
The following works but is inefficient since all of the calls to the package will return columns from the same record. I just don't know how to return all the values I need into the SELECT statement.
CREATE VIEW all_this_stuff AS
SELECT sequence_number, name,
rp.action_date(sequence_number) action_date,
rp.action_office(sequence_number) action_office,
rp.action_value(sequence_number) action_value
FROM table1
Is there a way to return multiple values into my SELECT statement or am I going about this all wrong?
Any suggestions?
Thanks so much!Hi,
What you want is a Top-N Query , which you can do using the analytic ROW_NUMBER function in a sub-query, like this:
WITH got_rnum AS
SELECT action_seq, action_dt, action_office, action_type, action_value
, ROW_NUMBER () OVER ( ORDER BY action_date
, action_seq
, action_serial
) AS rnum
FROM table2
WHERE action_code = 'AB'
AND action_office LIKE 'E' -- Is this right?
SELECT action_seq, action_dt, action_office, action_type, action_value
FROM got_rnum
WHERE rnum = 1
;As written, this will return (at most) one row.
I suspect you'll really want to get one row for each group , where a group is defined by some value in a table to which you're joining.
In that case, add a PARTITION BY clause to the ROW_NUMBER function.
If you'd post a little sample data (CREATE TABLE and INSERT statements), I could show you exactly how.
Since I don't have your tables, I'll show you using tables in the scott schema.
Here's a view that has data from the scott.dept table and also from scott.emp, but only for the most senior employee in each department (that is, the employee with the earliest hiredate). If there happens to be a tie for the earliest hiredate, then the contender with the lowest empno is chosen.
CREATE OR REPLACE VIEW senior_emp
AS
WITH got_rnum AS
SELECT d.deptno
, d.dname
, e.empno
, e.ename
, e.hiredate
, ROW_NUMBER () OVER ( PARTITION BY d.deptno
ORDER BY e.hiredate
, e.empno
) AS rnum
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
SELECT deptno
, dname
, empno
, ename
, hiredate
FROM got_rnum
WHERE rnum = 1
SELECT *
FROM senior_emp
;Output:
. DEPTNO DNAME EMPNO ENAME HIREDATE
10 ACCOUNTING 7782 CLARK 09-JUN-81
20 RESEARCH 7369 SMITH 17-DEC-80
30 SALES 7499 ALLEN 20-FEB-81
By the way, one of the conditions in the query you posted was
action_office LIKE 'E'which is equivalent to
action_office = 'E'(LIKE is always equivalent to = if the string after LIKE doesn't contain any wildcards.)
Did you mean to say that, or did you mean something like this:
action_office LIKE 'E%'instead?
Maybe you are looking for
-
Error code: 0x80070002 while attempting back up
Just upgraded Vista to Windows 7 Home Premium. When attempting to back up to an external hard drive with Windows back up in control panel it stops at about 20% completed and gives me the error code: 0x80070002. What can I do to fix this so that I can
-
Value in input field of Hier.Node variable displays tech.name of the IO
Dear all, we are facing an issue with Hierarchy node variable(auth.) in the selection screen of webReports. After selecting a hierarchy node value,it is displayed along with + sign and tech.name of the Infobject in input field . example: lets say we
-
Like many people I store my music files on an external hard drive to prevent my Mac hard drive from filling up. However I find iTunes doesn't keep the settings for the drive in preferences (as a library location) and reverting to users/[username]/mus
-
On my iPad mini, my inbox number count is over 500 even though the inbox. Is empty. All accounts do this on my iPad but all my other device are fine. Problem showed up two weeks ago???
-
Function to change status of the STS (Status and Tracking System)
Hi experts, do you know a way to execute a function that changes status in the STS hierarchy? We have a web interface with a BPS layout in it, and want to change the status of the STS according to the legal entity that has been changed as soon as a u