Retrieve Filter Field from af:Query Component
I'm using an af:query component on my form and have pre-definied ViewCriterias that load the page. Each ViewCriteria contains one field that is used across all of my search criterias....I need to be able to retrieve this field in my backing bean and get the value of it. I need to know what the user is searching on for this one particular field (i.e. which will always be available in the af:query. I have the queryListener pointing to a method in my backing bean...does someone have some sample code on how to access the fields used in the query and then access the value of one in particular?
public void headerQueryListener(QueryEvent queryEvent) {
CommonHelperFunctions.resolveMethodExpression("#{bindings.AllChangeOrdersQuery1.processQuery}",
null, new Class[] {QueryEvent.class}, new Object[] {queryEvent});
// What can I add here to retrieve a filter field and then retrieve it's value??
The queryListener on my af:query component then calls this headerQueryListener in my backing bean.
Thanks.
I have tried the following code just messing around:
QueryModel varQueryModel = getQueryHeader().getModel();
List<AttributeDescriptor> attributeDescriptors = varQueryModel.getAttributes();
AttributeDescriptor ad = attributeDescriptors.get(3);
The attributeDescriptors has the information that I need. I can see the elements in my query and I can see that element 3 is the one I want, but it doesn't have the an _attrDef name but it does have an mAttrName and the mValues[0] mValue has the value that I'm looking for, but I'm having trouble figuring out how to access this information and retrieve what i actually need. I'm very new to Java and ADF so sorry if this is a basic Java question, but if anyone could point me to an example or some sample code, I really appreciate it.
Thanks in Advance.
Similar Messages
-
How to retrieve all fields from Entiy Bean
Is there a simpler way to retrieve all fields from the entity bean than calling each individual get method?
I need to retrieve the entire record not the contents of the entire table.
Though, I may eventually need to do that also.
I have 56 fields on this table. It does not make sense to code a get statement for every field.
If you can direct me to sample code that would be good.
Also, are there any good examples out there of how to create an entity bean or session bean using a local interface?
Thanks,
JimI think you are confusing an EJB with a DAO.
If you want to access the database why not just use JDBC? -
How do I retrieve multiple fields from SQL?
I am trying to retrieve multiple fields from a SQL table such as customer name, address and phone number by entering the customer # in my form either in a text field or a data drop down list. I can get the drop downlist to populate from the table, however the other fields do not coorespond to my selection. It appears that they are from the first record in the table regardless of which customer # I select from the drop down list. Any assistance would be greatly appreciated.
Hi Carol.
Tried to follow Marks link but didn’t work.
Try this one.
http://blogs.adobe.com/formbuilder/2006/09/selecting_specific_database_records.html
At the moment I am about to start on this process with my form, so if you have any tips , please pass them on.
Raffe. -
Add custom field to af:query component?
Anyone had any experience overriding af:query copmonent? I need to add my custom search field (to query component), which would have a search icon next to it, and on click, a popup widow would open containing my custom task flow where I could select a record with certain value and on return that custom field (in query component) would get populated with selected value. I hope I'm being clear. Please point me to any useful information. Is that even possible? I use JDeveloper 11.1.2.3.4.0 Regards, Marko
Hi,
af:query is a component that comes as is. Its not designed for customization in that you can add your own fields. If you have a requirement for this then
1. expose a method on the VO Impl or AM Impl that expect arguments (your query parameters)
2. Use the arguments to populate bind variables used by a ViewCriteria
3. Apply the View Criteria to the View Object
4. Execte the View Object
5. Drag and drop the method from the DC panel as a parameter form
6. Ensure the result table PartialTrigger property is pointing to the button ID of the parameter form
7. Change whatever UI component you want to change in the parameter form
This gets you going ...
Frank -
Defaulting search fields in af:query component
I have a search popup with af:query and a result table. My requirement is to default some of the fields in af:query when the popup launches.
Since i could not achieve this, i wrote a temporary work around which should be removed as soon as we find a permanent solution.
Work around:
1. Wrote a method showQBE() in the bean. Wrote the logic to default the QBE fields by manually iterating through the component binding.
2. Call showQBE() in the visible property of the af:query so that this executed when the popup is invoked.
public boolean showQBE(){
RichQuery rq = this.getResourcePickerQBE(); // Bindning for QBE
QueryDescriptor dq = rq.getValue();
List children = rq.getChildren();
Iterator childrenItr = children.iterator();
while (childrenItr.hasNext()) {
RichPanelGroupLayout rpcl = (RichPanelGroupLayout)childrenItr.next();
Iterator rpclItr = rpcl.getChildren().iterator();
while (rpclItr.hasNext()) {
// RichPanelLabelAndMessage
UIComponent rplm = (UIComponent)rpclItr.next();
Iterator rplmItr = rplm.getChildren().iterator();
while (rplmItr.hasNext()) {
UIComponent comp = (UIComponent)rplmItr.next();
Iterator compItr = comp.getChildren().iterator();
while (compItr.hasNext()) {
UIComponent comp1 = (UIComponent)compItr.next();
String class2 = comp1.getClass().getSimpleName();
if (class2.equals("RichInputText")) {
RichInputText rit = (RichInputText)comp1;
if ("value40".equals(rit.getId()) ||
"value41".equals(rit.getId())) {
rit.setValue("Bryan");
} else if ("value50".equals(rit.getId()) ||
"value51".equals(rit.getId())) {
rit.setValue(ADFUtil.evaluateEL("Adams"));
} else
rit.setValue("");
AdfFacesContext.getCurrentInstance().addPartialTarget(rit);
Popup code:
<af:popup id="resourceSearch1"
popupFetchListener="#{backingBeanScope.TerritoryProfileBean.showParentTerrOwnerReportsForTerrTeamMember}"
binding="#{backingBeanScope.TerritoryProfileBean.resourcePickerPopup}"
popupCanceledListener="#{backingBeanScope.TerritoryProfileBean.cancelButtonListener}"
contentDelivery="lazyUncached" childCreation="deferred">
<af:dialog id="d20" type="none" title="#{salesterrmgmtterritoriesuiGenBundle}">
<af:panelGroupLayout id="pgl191" layout="vertical">
<af:panelHeader id="ph21" text=" ">
<af:query id="qryId2" headerText="#{applcoreBundle.QUERY_SEARCH_HEADER_TEXT}" disclosed="true"
value="#{bindings.ResourcePickerSearchQuery.queryDescriptor}"
model="#{bindings.ResourcePickerSearchQuery.queryModel}"
queryListener="#{backingBeanScope.TerritoryProfileBean.onSearchBtn}"
saveQueryMode="hidden" resultComponentId="::t3"
binding="#{backingBeanScope.TerritoryProfileBean.resourcePickerQBE}"
visible ="#{backingBeanScope.TerritoryProfileBean.showQBE}"
queryOperationListener="#{backingBeanScope.TerritoryProfileBean.queryOperationListener}"/>
</af:panelHeader>
<af:panelStretchLayout id="psl2" startWidth="50px"
visible="#{backingBeanScope.TerritoryProfileBean.showSearchTable}">
<f:facet name="bottom"/>
<f:facet name="center">
<af:table value="#{bindings.ResourcesPicker.collectionModel}"
var="row"
rows="#{bindings.ResourcesPicker.rangeSize}"
emptyText="#{bindings.ResourcesPicker.viewable ? applcoreBundle.TABLE_EMPTY_TEXT_NO_ROWS_YET : applcoreBundle.TABLE_EMPTY_TEXT_ACCESS_DENIED}"
fetchSize="#{bindings.ResourcesPicker.rangeSize}"
rowBandingInterval="0"
selectionListener="#{bindings.ResourcesPicker.collectionModel.makeCurrent}"
rowSelection="multiple" id="t3"
binding="#{backingBeanScope.TerritoryProfileBean.resourcePickerTable}"
contentDelivery="immediate"
columnSelection="multiple" autoHeightRows="10"
summary="#{salesterrmgmtterritoriesuiBundle.THIS_TABLE_LISTS_THE_RESOURCES}">
<af:column sortProperty="ResourceName" sortable="true"
headerText="#{bindings.ResourcesPicker.hints.ResourceName.label}"
id="c3" rowHeader="unstyled">
<af:inputText value="#{row.bindings.ResourceName.inputValue}"
label="#{bindings.ResourcesPicker.hints.ResourceName.label}"
required="#{bindings.ResourcesPicker.hints.ResourceName.mandatory}"
columns="#{bindings.ResourcesPicker.hints.ResourceName.displayWidth}"
maximumLength="#{bindings.ResourcesPicker.hints.ResourceName.precision}"
shortDesc="#{bindings.ResourcesPicker.hints.ResourceName.tooltip}"
id="it6">
<f:validator binding="#{row.bindings.ResourceName.validator}"/>
</af:inputText>
</af:column>
<af:column sortProperty="PrimaryPhoneNumber" sortable="true"
headerText="#{bindings.ResourcesPicker.hints.PrimaryPhoneNumber.label}"
id="c6">
<af:inputText value="#{row.bindings.PrimaryPhoneNumber.inputValue}"
label="#{bindings.ResourcesPicker.hints.PrimaryPhoneNumber.label}"
required="#{bindings.ResourcesPicker.hints.PrimaryPhoneNumber.mandatory}"
columns="#{bindings.ResourcesPicker.hints.PrimaryPhoneNumber.displayWidth}"
maximumLength="#{bindings.ResourcesPicker.hints.PrimaryPhoneNumber.precision}"
shortDesc="#{bindings.ResourcesPicker.hints.PrimaryPhoneNumber.tooltip}"
id="it10">
<f:validator binding="#{row.bindings.PrimaryPhoneNumber.validator}"/>
</af:inputText>
</af:column>
<af:column sortProperty="EmailAddress" sortable="true"
headerText="#{bindings.ResourcesPicker.hints.EmailAddress.label}"
id="c5">
<af:inputText value="#{row.bindings.EmailAddress.inputValue}"
label="#{bindings.ResourcesPicker.hints.EmailAddress.label}"
required="#{bindings.ResourcesPicker.hints.EmailAddress.mandatory}"
columns="#{bindings.ResourcesPicker.hints.EmailAddress.displayWidth}"
maximumLength="#{bindings.ResourcesPicker.hints.EmailAddress.precision}"
shortDesc="#{bindings.ResourcesPicker.hints.EmailAddress.tooltip}"
id="it1">
<f:validator binding="#{row.bindings.EmailAddress.validator}"/>
</af:inputText>
</af:column>
</af:table>
</f:facet>
</af:panelStretchLayout>
</af:panelGroupLayout>
<f:facet name="buttonBar">
<af:group id="g41">
<af:commandButton actionListener="#{backingBeanScope.TerritoryProfileBean.onApplyOrDoneFromResourcePicker}"
id="cmdDone1" immediate="true"
partialSubmit="true"
text="#{acrGenBundle}">
<af:resetActionListener/>
</af:commandButton>
<af:commandButton id="cb5" actionListener="#{backingBeanScope.TerritoryProfileBean.cancelButtonListener}"
text="#{acrGenBundle}"/>
</af:group>
</f:facet>
</af:dialog>
</af:popup>
* I created the same thread ADFbc forum: http://myforums.oracle.com/jive3/thread.jspa?threadID=632625. Since there is no response posting here.
ThanksThe af:query is based on a View Criteria from a PVO, so i wrote the following code to set the value for the criteria items in the View criteria.
I wrote it in view object's getter in the AMImpl.java
public ResourcePickerVOImpl getResourcePicker(){
ResourcePickerVOImpl vo = findViewObject("ResourcesPicker");
ViewCriteria vc = (ViewCriteria)vo.getViewCriteria("ResourcePickerSearch");
ViewCriteriaManager vm = vc.getViewCriteriaManager();
Row rows[] = vc.getAllRowsInRange();
for(Row row : rows){
List<ViewCriteriaItem> cit = ((ViewCriteriaRow)row).getCriteriaItems();
Iterator<ViewCriteriaItem> itr = cit.iterator();
while(itr.hasNext()){
ViewCriteriaItem vtr = itr.next();
vtr.setValue("Mathew");
System.out.println("Column name: " + vtr.getColumnName() + " Value: " + vtr.getValue());
I changed the contextDelivery = immediate and childrenCreation = immediate since the popup was always showing empty search fields.
After changing this property i am seeing a new issue -> First time when i open the popup nothing is shown in the search fields. Then from the subsequent times it is showing the values defaulted through the above code.
Any idea!
Edited by: [email protected] on Aug 26, 2010 4:30 AM -
Hi All,
My users require the ability to select a sharepoint group from a drop down list and then be able to select a user from a people picker based on the drop down selection. The best solution I was able to up with, was create a people picker
for each drop down selection and set the Sharepoint group field to the selected group. All people picker filed are hidden except the one that matches the drop down selection. When creating an entry from the sharepoint list this method
works perfectly.
However, when I add the list onto a site page using an "Listview webpart", then add an infopath web part and then finally connect the two parts, I get a "List View Lookup Threshold" error when selecting an entry from the list. I
understand from the error and reading that this error is related to the number of People pickers in the list. Is there a way to exclude temporary people picker fields from a site page query, as they are only temporary fields to allow the users
to select a person and then assign the name to another field.
DwayneHi Dwayne,
In SharePoint 2013, we could manually create a list for all users. Here are the reference:
Go to Site Settings > People and Groups > SiteMembers
Modify url
http://sitename/_layouts/15/people.aspx?MembershipGroupId=8 to
http://sp/sites/tutu/_layouts/15/people.aspx?MembershipGroupId=0 , now you will see All people in this site.
Change the view to List view, and copy the listview id in the url
http://sitename/_layouts/15/people.aspx?MembershipGroupId=0&View={viewID}
Go to Settings > List settings, copy the list id in the url
http://sitename/_layouts/15/listedit.aspx?List=listeid&Source=....
Now type the address in IE:
http://sitename/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=[LISTID]&View=[VIEWID]&CacheControl , such as
http://sp/sites/tutu/_vti_bin/owssvr.dll?CS=109&Using=_layouts/query.iqy&List=f3958d27-9c2f-4f8d-b221-89466e816667&View=696BFDC5-0C6E-4E27-818F-0E6292A18407&CacheControl=1
Save the owssvr.jqy from SharePoint site
Now you could see the file in your desktop with all users, save it as allusers in Excel.
Then import it to your SharePoint site, add an app > find an app > import spreadsheet
Regards,
Rebecca Tu
TechNet Community Support -
Retrieving hierarchy fields from MDM to SAP R/3 using MDM ABAP API's
Hi all,
I have developed a code to retrieve fields from MDM to SAP R/3 using MDM ABAP API's, i could retrieve all of the fields excluding the Lookup[Hierarchy] fields like- FACILITY CODE etc...
please update me if anyone has any experience on this.
Thanks and regards,
Aastha MehrotraHi ,
Any one worked in the MDM API to retrieve Hierarchy fields ???
Regards,
Arun. -
Timezone effects on Date and Timestamp fields in af:query component
Hello,
I'm working on an ADF application where time zone is configured as follows:
* Dynamic View Layer time zone is configured in trinidad-config.xml file and bound to a session scoped value:
<trinidad-config>
<skin-family>fusionFx</skin-family>
<time-zone>#{sessionScope.tz}</time-zone>
</trinidad-config>* ADF BC time zone is configured in adf-config.xml file and bound to View Layer time zone:
<adf-config>
<user-time-zone-config xmlns="http://xmlns.oracle.com/adf/usertimezone/config">
<user-timezone expression="#{adfFacesContext.timeZone.ID}"/>
</user-time-zone-config>
</adf-config>The problem here is that Dates and Timestamp values work as expected all over the application except for the af:query component. When displayed as af:inputDate in af:form, Dates and Timestamp values are NOT getting converted to the time zone (TZ) configured in trinidad-config.xml file, whereas TimestampTz and TimestampLtz are. However, when displayed in af:query component, Dates and Timestamp values are automatically converted to View Layer TZ after a search has been performed.
For example, say View Layer TZ = US/Pacific and we enter 01/jun/2011 as a search criteria of type Date and then click on the Search button. The displayed value automatically changes to 25/nov/2011, that is, it gets converted to the WLS JVM time zone, which is set to Europe/London.
Is conversion of Date and Timestamps in af:query component the expected behaviour or could this be a bug?
Is there any way to avoid this conversion?
Thanks in advance
Version:
ADF Business Components 11.1.1.59.23
Java(TM) Platform 1.6.0_21
Oracle IDE 11.1.1.4.37.59.23
PMD JDeveloper Extension 4.2.5.3.0
Repost on 26-nov-2011 9:29
Repost on 28-nov-2011 15:10
Edited by: Barbara Gelabert on 26-nov-2011 9:29
Edited by: Barbara Gelabert on 28-nov-2011 15:10Hi,
Thanks for your reply. This certainly seems promising. However, I am getting a connection error now.
The following...
jar_loaded = require 'ojdbc14.jar'
puts "Oracle jar loaded? #{jar_loaded}"
puts "Starting active record"
require 'rubygems'
gem 'activerecord'
gem 'activerecord-oracle_enhanced-adapter'
require 'activerecord'
puts "Connecting to MXGN"
ActiveRecord::Base.establish_connection(
:adapter => 'oracle_enhanced',
:host => 'THEHOST',
:port => '1550',
:database => 'THEDB',
:username => 'THEUSER',
:password => 'THEPASSWORD'
... produces
Oracle jar loaded? true
Starting active record
Connecting to MXGN
ERROR: ActiveRecord oracle_enhanced adapter could not load Oracle JDBC driver. Please install ojdbc14.jar library.
ERROR: ActiveRecord oracle_enhanced adapter could not load Oracle JDBC driver. Please install ojdbc14.jar library.
C:/jruby/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in `establish_connection': Please install the oracle_enhanced adapter: `gem install activerecord-oracle_enhanced-adapter` (LoadError) (RuntimeError)
from H:\sandbox\DBPlay\lib\main_enhanced.rb:12
I'm confused. Am I missing the driver, or have I failed to setup the enhanced Oracle adapter?
I have tried moving the jar to $JRUBY_HOME/lib too, but the result was the same.
All help would be greatly appreciated.
Many Thanks
Adrian -
Reference a field from master query in detail query
Hi,
Please tell me how do I reference a field say incident_no in my master query to a detail query.
like
detail.incident_no != master.incident_no
I am joining both the queries using a link. But still I need to reference another field from the first query in my second query. I thought this was possible using formula columns or trigger's. Please help.Hey Vadim,
That worked. How come.. You know I did it several times before and all it said was, that it was going to create a new parameter field called so and so.
Good, so does it work just this time or always ? just kidding. Reports is so unpredictable, at least for me.
Thanks Vadim,
Joe. -
Passing/retrieving hidden fields from Its template(IAC) to BSP page
Hi i m passing hidden fields from its template to custom BSP page...but not able to retrieve the hidden field in bsp page...is there any way we can retrieve the data....is there any equivalent of request.getattribute() method which we use in jsp to fetch the hidden fields....
<i>i m passing hidden fields from its template to custom BSP page...but not able to retrieve the hidden field in bsp page...</i>
from ITS template how are you calling/passing parameter to BSP
thru a form submit? or are you just openning the BSP thru a url link, in either case
you could pass the data as a form field (post) or in the url of the BSP (GET)
for example if the form field name in ITS template is myformfiled and you are submitting that to the BSP page then in the corresponding bsp page declare a page attribute withe same name (myformfiled) and mark the auto check box.
now the value passed from ITS template will be available within BSP in the ABAP variable myformfiled which you can use the way you want.
Hope this is clear
Raja -
Urgent Requirement : How to retrieve Description field from Info type 1002
Hi,
My requirement is to fetch description field from infotype 1002 which will be stored in text format.
I think this will be stored in TTEXT table but am not able to fetch using that.
Can anyone please help me out in this.
Thanks in Advance,
Sarika.Try out following tables
T582ITOPERT Infotype Operation Texts
T582S Infotype Texts
T591S Subtype Texts
T777U Subtype Texts -
Retrieve changing values from TextInput Flash Component
Hi,
I've been banging my head against the wall with this one....
I've placed aTextInput Flash Component on the stage which
reads/displays a value from an external text file. So far so good.
If I enter new text during run-time - editable is set to true
- the TextInput component updates to reflect what I've typed. BUT,
how do I retrieve that text to a variable? (I need to save the new
value back to the external text file).
Current code:
myfieldtext = sprite(51).text
And eventPassMode is set to passAlways
this retrieves the initial value regardless of what I type.
Any help appreciated!I'm not sure if this all helps, but I had to make a flash
name input box
recently. I was getting all sorts of weird results trying to
get the text
out of flash. It was giving me all the font info etc, and I
just needed the
name. So what I ended up doing is when they were done
entering the text, I
put the text into a variable within flash, then pulled the
data from that
variable rather than striaght out of the text.
in director, in the behaviour attached to the flash sprite:
myText = sprite("nameInput").getVariable( "myNameString",
True)
where the sprite is named "nameInput". It seems better to
name the sprite
and refer to it that way than using the sprite number, such
as sprite(51).
In flash I have the text input field named "textInput", and
the following
code attached to the save button. You may have to use a
different event,
like when they text input loses focus.
on (release) {
var myNameString = "";
myNameString = textInput.text
trace(myNameString)
getURL('event:doEvent,1')
Timm
"tayl" <[email protected]> wrote in message
news:edjutm$ptl$[email protected]..
> Hi,
>
> I've been banging my head against the wall with this
one....
>
> I've placed aTextInput Flash Component on the stage
which reads/displays a
> value from an external text file. So far so good.
>
> If I enter new text during run-time - editable is set to
true - the
> TextInput
> component updates to reflect what I've typed. BUT, how
do I retrieve that
> text
> to a variable? (I need to save the new value back to the
external text
> file).
>
> Current code:
> myfieldtext = sprite(51).text
> And eventPassMode is set to passAlways
>
> this retrieves the initial value regardless of what I
type.
>
> Any help appreciated!
>
>
> -
Populate Form Field from Post-Query Trigger
I have a form with some fields like "start_date", "company_id", "previous_start_date", "previous_company_id". Out of these, the "previous" fields are unbound and the others are bound to "my_companies" table. All are in the same block on the form. I have a post-query trigger which runs a cursor to select "previous" values based on the "start_date" and "company_id". More than one "previous" values is retrieved each time. My problem is that my cursor writes back only one value into my form field. I ran the cursor as a pl/sql block in TOAD to test and it fetches all the records that I need. I'm not sure what I'm doing wrong in writing the values into form items. The form items are of type "custom" and display type is "text" (I'm creating the form in Oracle Designer). My cursor code is something like this:
declare
cursor previous_data_cur is
select company_id,start_date
from my_companies
where company_id = :myblock.company_id
and start_date < :myblock.start_date;
BEGIN
open previous_data_cur;
LOOP
fetch previous_data_cur into :myblock.prev_company_id, :myblock.prev_start_date;
EXIT WHEN previous_data_cur%NOTFOUND;
END LOOP;
close previous_data_cur;
END; Can anyone provide any pointers on what I could be doing wrong or what I should do to make this work?
Any help is greatly appreciated.Do you have several previous date fields per record?
How are they named? Previous_date_1, previous_date_2,...?
Try this:
declare
cursor previous_data_cur is
select start_date
from my_companies
where company_id = :myblock.company_id
and start_date < :myblock.start_date;
l_previous_data previous_data_cur%ROWTYPE;
l_count NUMBER;
BEGIN
l_count := 1
FOR l_previous_data IN previous_data_cur
LOOP
copy(l_previous_data.start_date, 'my_block.previous_start_date_'|| l_count);
END LOOP;
END; Caution:
- number of retrieved records may not exceed number of previous_date fields.
- not tested -
SAP Query: How to filter records from SAP Query output before display
Hi Friends,
Can I delete records from an SAP query basic list before it is displayed?
For example I want to delte all the orders whose system status is "RELEASED" before the basic list of that SAP query is displayed.
I have gone through SAP help and found out that we can write some code in <b>END code</b> section which will execute before the basic list of the query is displayed. But I could not figure out how the code this...following is an excerpt form SAP help.
<b>"The END-OF-SELECTION code consists of two parts (Before list output and After list output). The first part is processed before the list is output and the second part afterwards."</b>
Can anybody help me?
Regards,
Bharat.
Message was edited by:
Bharat Reddy VTry this simple procedure. <b>Hope</b> this should work for you.
You do the slection of the status in the List-Processing. say your final field of status flag is GF_STATUS.
Immediatly after that use this within the List-Processing.
CHECK GF_STATUS EQ '<RELEASED STATUS>'
How it works:
SELECT <> "<-------Query processing(system code).
*< Your code put in the List processing
CHECK GF_STATUS EQ '<RELEASED STATUS>' "< --only released records passed.
*>
ENDSELECT "<-----Query endselect(system code).
Please let me know the result.
Regards,
A.Singh
Message was edited by:
Amarjit Singh -
Retrieve varchar column from Oracle query in a resulset
Hi, I'am a begginer in JSP Technologies.
I've do a small jsp that opens a db connection to an oracle, execute a query a show results.
When the columns of the query are int I've no problem, the jsp show the columns of the resulset, but when the columns selected are varchars the jsp doesn't show anything....
Can anyone help me?
Example:
Table: CUSTOMERS
Col1 : ID_COSTUMER int
Col2: CUSTOMER_NAME varchar
<%
Connection canal = null;
ResultSet tabla = null;
Statement instruccion=null;
try { Class.forName("oracle.jdbc.driver.OracleDriver");
canal=DriverManager.getConnection("jdbc:oracle:thin:@XXXXXXXXXXXXXXXXXXXp");
instruccion = canal.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
} catch(java.lang.ClassNotFoundException e){};
String Query = "SELECT ID_CUSTOMER FROM CUSTOMERS";
try { tabla = instruccion.executeQuery(Query);
out.println("<TABLE Border=10 CellPadding=5><TR>");
out.println("<TD>CUSTOMER</TD></TR>");
while(tabla.next()) {
out.println("<TR>");
out.println("<TD>"+tabla.getString(1)+"</TD>");
out.println("</TR>"); };
out.println("</TABLE></CENTER></DIV></HTML>");
tabla.close(); instruccion.close(); canal.close();}
catch(SQLException e) {};
%>Results:
CUSTOMER
1
2
3
4
Doing the change in query:
SELECT CUSTOMER_NAME FROM CUSTOMERS
I have not results....
Thank you.sorry, I misplaced an ending code bracket on last one
I'm not really familiar with doing this inside a jsp.. but there are a few things that you should try to make sure that it isn't a database problem before assuming it is a problem on your jsp.... It is possible you have already tried the following but just to make sure.
When you do the second query does the first two out.printlns that are before the while still output? If not then your query is incorrect.
Second I would try
String Query = "SELECT ID_CUSTOMER,CUSTOMER_NAME FROM CUSTOMERS";
try { tabla = instruccion.executeQuery(Query);
out.println("<TABLE Border=10 CellPadding=5><TR>");
out.println("<TD>CUSTOMER_ID</TD><TD>CUSTOMER_NAME</TD></TR>");
while(tabla.next()) {
out.println("<TR>");
out.println("<TD>"+tabla.getString(1)+"</TD>");
out.println("<TD>"+tabla.getString(2)+"</TD>");
out.println("</TR>"); };
out.println("</TABLE></CENTER></DIV></HTML>");I suspect this will also return nothing.. if that is the case then you need to check your database. If it does infact return values for the ID and nothing for the NAME then I'm not sure at this point what the problem is.
Maybe you are looking for
-
Is it possible to reduce the size of a single image on a slide now in keynote 6.0?
This feature seems to have disappeared in the update and the only option is to reduce the whole file size.. Thanks!
-
Please help ! I don't want to lose all the data on there if i don't have to !! Can I fix this without restoring it? Is there a way to get it unlocked again where I won't lose data on there? Thanks !!
-
Whenever I connect my external monitor (Dell 1600x12000) My laptop gets really slow and my internet connection plummets, please help!!
-
HT1212 how do i unlock my ipod
My ipod is locked and i cant open it.It says ipod disabled try again in 22,718,624 minutes! How can i reset it?
-
Why did carefully over heating my 4s restore the wifi function? This, after 2 months of mysteriously grey out wifi buttons, loads of time trying to resolve issue with apple tech only to be told I must pay $199 to repair the problem. I'm disillusioned