To find the "column value" when clicked on Dynamic datatable
I ahve done a dynamic table where the first row alone i ahve declared as command link.So when I click on the commadn link I need to get either column name or column count or rowdata.If I Get then I have some logic based on it to do.
I have placed my dynamic datatable code below.
public class Datatable2 extends PageCodeBase
UIData dataTable =new UIData();
public Datatable2()
UIColumn col;
UIOutput out = null;
ArrayList al=new ArrayList();
al.add("Item");
al.add("Creation date");
al.add("Priority");
Application app = FacesContext.getCurrentInstance().getApplication();
int colCount = 3;
for(int j = 0; j < colCount; ++j) {
out = new UIOutput();
col = new UIColumn();
if(dataTable.getRowIndex()==-1)
MethodBinding mb = app.createMethodBinding("#{pc_DataTable.item}", null);
HtmlCommandLink link = (HtmlCommandLink)app.createComponent(HtmlCommandLink.COMPONENT_TYPE); link.setActionListener(mb);
link.setAction(mb);
link.setId("Command"+j);
ValueBinding vb1 = app.createValueBinding("#{commands" + j + "}");
link.setValueBinding("value",vb1);
link.setRendererType("javax.faces.Link");
HtmlOutputText O = new HtmlOutputText();
O.setValue(al.get(j).toString());
link.getChildren().add(O);
col.setHeader(link);
ValueBinding vb = app.createValueBinding("#{rows["+j+"]}");
out.setValueBinding("value", vb);
out.setRendererType("javax.faces.Text");
col.getChildren().add(out);
dataTable.getChildren().add(col);
public UIData getDataTable()
return dataTable;
public void setDataTable(UIData dataTable)
this.dataTable=dataTable;
public Object[] getTableRows()
Object[] test = new Object[]{new String[]{"1","2","3"},
new String[]{"4","5","6"},
new String[]{"7","8","9"},
new String[]{"10","11","12"},
new String[]{"13","14","15"}};
return test;
this is my jsp code
<f:view>
<P>Place content here.</P>
<h:form>
<h:dataTable binding="#{pc_Datatable2.dataTable}" value="#{pc_Datatable2.tableRows}" var= "rows" />
</h:form>
</f:view>
Could please tell how can i figure out my coulmn value when clicked on the command link
hello,
u can use two types methods u can create a dynamic action or by branching using conditional or java script code
for java script code just call the code when button clicked and in javascript function by using if condition u can redirect.
Regards,
Ramana
Similar Messages
-
Hello Everyone,
How to update zero to a column value when record does not exist in table but should display the column value when it exists in table
Regards
Regards Gautam SAs per my understanding...
You Would like to see this
Code:
SELECT COALESCE(Salary,0) from Employee;
Regards
Shivaprasad S
Please mark as answer if helpful
Shiv -
How to find the column name and table name with a value
Hi All
How to find the column name and table name with "Value".
For Example i have value named "Srikkanth" This value will be stored in one table and in one column i we dont know the table how to find the table name and column name
Any help is highly appricatable
Thanks & Regards
Srikkanth.M2 solutions by Michaels (the latter is 11g upwards only)...
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
SQL> select table_name,
column_name,
:search_string search_string,
result
from cols,
xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
columns result varchar2(10) path '.'
where table_name in ('EMP', 'DEPT')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME ES RESEARCH
DEPT DNAME ES SALES
EMP ENAME ES JONES
EMP ENAME ES JAMES
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES PRESIDENT
EMP JOB ES SALESMAN
9 rows selected. -
Finding the same value in different columns
Hello,
I am trying to figure out how I would go about finding the same value in the same row but in different columns. For example, in the table sometimes the report name is the same as the description. I would like to find all of the rows where this is the case.
Thanks
Report name
Description
Date
Time
Report 1
Report 1
dddd
tttt
Report 2
Billing Report
dddd
tttt
Report 3
Report 3
dddd
ttttHi,
Is this what you want?
SELECT * -- or whatever columns you want
FROM table_x
WHERE report_name = description
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Can I keep the CC value when user click the REPLY TO button in outlook?
Hi all,
I have set the CC value when I send email out. But when user reply the received email, the CC value will be displayed in the TO field. If anyone knows how can I keep the CC value unchanged when user reply the received email?
Thanks very much.It depends entirely on the mailer they're using, you have no control over it.
-
How to find the RGB Values of a Color for Hyperion
When customizing your Hyperion forms, we come across situations where we need the exact RGB value of a given color. This article explains a simple technique to find the RGB values using MS Paint and the Calculator applications that come as standard applications with your operating system.
Here are the steps to find the exact RGB value of a given color.
1) View your Hyperion form using IE, scroll down until you see the color you want to find the RGB value and press the "Print Screen" button (in your keyboard).
2) Open MS Paint and click Edit -> Paste or simply Ctrl+V. What you saw in the browser will be copied as a new untitled image.
3) Select the Color Picker tool and click on an area that has the color you want to match.
4) Now go to Edit Colors... option and click on the "Define Custom Colors >>" button. The color you picked will be selected on this palette. At the bottom right hand corner you will see the Red, Green and Blue values you need. Note down the R,G,B values (given in decimal).
5) Now we need to find out the hexa-decimal values that correspond to those decimal values. This is where we use the simple Calculator. Open the Calculator application from Program -> Accessories. Switch to the scientific mode by clicking View ->Scientific.
6) By default it will be in the decimal number mode. Enter the R value (238 in this example) and click on the Hex radio button. The corresponding hexa-decimal value (EE in this case) will be shown in the dial.
The selected color in this case has the same value for R, G and B. (In fact, all shades of gray has the same values for R, G and B.) Therefore, the RGB value of the background color that we need is #eeeeee. Repeat step 6 to find out the hex value for the Green and Blue elements, if they are different.
Tip:
If you find it difficult to pick a color, zoom the image by pressing Ctrl+PageDown or using View -> Zoom -> Custom... option.These tips are to find the RGB color of HFM default row where row is text and text lines in data columns are also visible to business users as Yellow as an input cell. By applying the same RGB color you can apply the same color to your data cells or rows. This post shows how to identify color from any web view-able object.
Regards,
Manaf -
How to use my findTheHighest method to find the highest value in my two dim
I am going to create a 13row by 10 colume two dimensional array.
how to use my findTheHighest method to find the highest value in my two dimensional array.
.When i compile this program , i got those as following;
"Exception in thread "main" java.lang.ArrayIndexOutOfBoundsExce
at TaxEvolution.findTheHighest(TaxEvolution.java:31)
at TaxEvolutionClient.main(TaxEvolutionClient.java:25)"
public class TaxEvolution{
public double[][] salesTaxRates;
public TaxEvolution()
salesTaxRates = new double[13][10];
fillProvinTaxRates();
private void fillProvinTaxRates()
for ( int row = 0; row < salesTaxRates.length; row++ )
for ( int column = 0; column < salesTaxRates[row].length; column++ )
salesTaxRates[row][column]= (int)(Math.random()*5000) + 1;
public double findTheHighest()
double highest = salesTaxRates[0][0];
for ( int row = 0; row <= salesTaxRates.length; row++ )
for ( int column = 0; column <= salesTaxRates[row].length; column++ )
if ( salesTaxRates[row][column] >= highest )
highest = salesTaxRates[row][column];
return highest;
public double[][] arrayTaxEvolution()
double[][] returnTaxRates = new double[13][10];
for ( int row = 0; row < salesTaxRates.length; row++ )
for ( int column = 0; column < salesTaxRates[row].length; column++ )
returnTaxRates = salesTaxRates;
return returnTaxRates;
public class TaxEvolutionClient{
public static void main( String[] args ){
TaxEvolution protaxRateList = new TaxEvolution();
double[][] taxRateList = protaxRateList.arrayTaxEvolution();
for ( int i = 0; i < taxRateList.length; i++ )
for ( int j = 0; j < taxRateList[0].length; j++ )
System.out.print( taxRateList[i][j] + "\t" );
System.out.print( protaxRateList.findTheHighest + "\t" );
}Multiposted
http://forum.java.sun.com/thread.jspa?threadID=699057&tstart=0 -
Where can I find the column declarations of table X$BH? or X$ tables?
Hi all,
does anyone know where can I find the column declarations for each X$ tables?
I did some googling and with no luck.
So, hoping that I can get some help here!
Thanks in advance!PhoenixBai wrote:
does anyone know where can I find the column declarations for each X$ tables?X$ tables are not "real" tables. They are similar to the +/proc+ file system on Linux that looks like a file system with directories and files, but is actually a view into kernel memory structures.
X$ tables are a view of internal Oracle kernel memory structures. And you need to be careful how you use these - not just how you interpret the data in them. Some structures when touched (using a select against that X$ table), will actually reset the values in the struct. (e.g. <i>X$KSMLRU - LRU flushes from the shared pool - (7.3 - 8.1) [ID 43600.1]</i>).
The basic question you need to ask yourself is what are you looking for using the X$ views into the internals of Oracle? Why are you not using the V$ and GV$ views instead? - these are what 99% of all dba admins and experts and tools use. The times that one need to dig into X$ views (that are mostly undocumented and can have major changes from version to version) are very rare. And requires at least some basic knowledge of how databases and operating systems work internally. -
How to get the column values from a BC4J View Table in UIXML?
I am using a default UiXML Application for Order Entry system with Orders & Order Lines & Customers. I have a uix file OrdersView1_View.uix which displays (no updateable columns) all the Orders. How do I get the column value of a selected row in a BC4J Table (example:OrdersId) when a Submit button is pressed using UIXML or Java Classes?
I appreciate any help on this.Hi,
You need to use keyStamp, an example:
<bc4j table name="orders">
<bc4j:keyStamp>
<bc4j:rowKey name="key" />
</bc4j:keyStamp>
Furthermore, you can automatically send the selected row key using the go event handler, so in the handlers section you could send the key to an orderInfo page:
<event name="show">
<!-- forward to the update page, passing
the selected key as a page property -->
<ctrl:go name="orderInfo" redirect="true">
<ctrl:property name="key">
<ctrl:selection name="orders" key="key" />
</ctrl:property>
</ctrl:go>
</event> -
How to find the PREVIOUS value of a non-DB item?
I want to do a simple thing but found it impossible.
I want to find the previous value of a non-DB item in a form.
I tried creating a text item and populating it using PRE-TEXT-ITEM but that does not work.
WHEN-VALIDATE-ITEM does not work either because WVI fires only after item value has changed.
Any suggestions will be greatly appreciated.
Edited by: Channa on Apr 2, 2010 4:34 AMChanna wrote:
I want to do a simple thing but found it impossible.
I want to find the previous value of a non-DB item in a form.
I tried creating a text item and populating it using PRE-TEXT-ITEM but that does not work.
WHEN-VALIDATE-ITEM does not work either because WVI fires only after item value has changed.
Any suggestions will be greatly appreciated.
Edited by: Channa on Apr 2, 2010 4:34 AMPlease make it clear what is your requirement then possibly we can provide you a better answer
You can use Global variables for to store old values also on Post-query populate a value in separate field or Parameter -
"system cannot find the file specified" when launching a java app
Hi,
we are receiving an error message saying "The system cannot find the file specified" when launching a java app on a server. Exactly the same configuration on another server does not give the same problem.
The dialog box with the error message only presents one button - OK - and after pressing the button the app continues to run normally. This however is a big problem for us as we are trying to convert the apps into system services using the wrapper (http://wrapper.tanukisoftware.org).
Note: the problem exibits itself with and without the use of the wrapper.
I am not very comfortable about reinstalling the JRE on a production server. Is there any way to see what file it is missing? Debug options or something similar?
The JRE in question is 1.4.2_06. Many thanks in advance for your answers.if not setting Post-Processing option results in a cryptic error why doesn't Adobe do one of at least three things?
1. Don't let user click Export on Export dialog if nothing's selected for Post-Processing.
2. Default Post-Processing to Do Nothing
3. Give the user a hint as to what the problem is when the error occurs instead of issuing cryptic error message.
Allowing this error to persist for so long is ridiculous. -
Missing column value when logged on to windows with user id other then admi
I am using crystal report 10 with oracle 10g database. Application is is developed on vissual studio.net 2005 (vb.net). Reports are launched from vb.net application.
My report runs fine when I logon to windows as administrator and launch vb.net application. When I logeed on to windows with userid other then administrator my application works fine except one of the column value is missing a value in the report. When I launch my vb.net application my oracle userid is same. Only difference is windows userid. My application has no referance to windows userid. Why crystal report viewer is missing one column value when loged on to windows as user(xxxx)?CR 10.2 bundles with .NET 2005. If you do not see the CR assemblies of version 10.2.3600 in GAC, try to do a custom install of .net 2005, choosing just Crystal Reports. Note that Crystal Reports does not bundle with all versions of .NET (for example it does not ship with .NET Express - I believe...). Alternatively, you can upgrade to CR 2008 which is the latest sipping version of Crystal Reports. You can obtain a copy by calling sales at 866-681-3435, or go to this link:
www.businessobjects.com/product/catalog/crystalreports
An eval copy of CR 2008 can be downloaded from here:
http://www.businessobjects.com/forms/default.asp?id=701600000009BXP
Ludek -
Finding the min value in a hashtable
Hi,
I'm trying to work out the lowest value contained in a hashTable. So far I've got.
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
public class StoreValuesDouble extends Statistic {
* Each object of the class (StoreValuesDouble) will have these attributes.
* When you call the StoreValuesDouble class you can use
* myDoubleValues (a Vector holding Double types),
* Hashtable (a Hashtable using Double types as values and keys) and
* nullValues (an Double currently set to 0.0).
Vector<Double> myDoubleValues; //declare a variable myDoubleValues that is of data type Vector
Hashtable<Double, Double> myValues; //declare a variable myvalues that is a data type Hashtable
Double nullValues = 0.0; //Double attribute to count the number of null values contained in the vector
* pass myDoubleValues to inValues
* @param Vector /<Double/> a vector holding Double values
* @param inValues the values in the vector
* @return
public void DoubleStat(Vector<Double> inValues) {
myDoubleValues = inValues;
* calculate the mean of myDoubleValues
* @return mean of myDoubleValues as a double
public double meanDouble() {
double mean = 0;
Double currentDouble;
double nonNull = 0;
for (double j = 0; j < myDoubleValues.size(); j++)
currentDouble = myDoubleValues.elementAt((int) j);
if (currentDouble != null) {
mean += currentDouble.doubleValue();
nonNull++;
return mean / nonNull;
* calculate the standard devitation of myDoubleValues
* @return standard devitation of myDoubleValues as a double
public double standardDeviationDouble() {
double m = meanDouble();
double t = 0.0;
Double currentDouble;
double n = 0;
for (double j = 0; j < getDoubleValues(); j++) {
currentDouble = myDoubleValues.elementAt((int)j);
if (currentDouble != null) {
n = currentDouble.doubleValue();
t += (n - m) * (n - m);
return Math.sqrt(t / (myDoubleValues.size() - 1.0));// n - 1 as sample varience
* return the number of values of myDoubleValues to help calculate the mean & standard deviation
* @return the size of myDoubleValues as a Double
public double getDoubleValues() {
return myDoubleValues.size();
* compute the number of null values
* @return a double value representing the number of null values
public Double getDoubleNull() {
Double nbNull = 0.0;
// test if myIntValues is null
if (myDoubleValues == null) {
System.out.println("Please enter values that are not null!");
return 0.0;
// if not null, parse all values
// for each value, test if it is null or not
Double currentDouble;
for (double i = 0; i < myDoubleValues.size(); i++) {
currentDouble = myDoubleValues.elementAt((int)i);
if (currentDouble != null) {
/// nothing to do
else {
nbNull++;
return nbNull;
//find the MIN values in the Hashtable to give us the range (with the MAX value)
public Double MinDouble()
Double MinDouble = null;
Double currentValue;
for (double j = 0; j < myDoubleValues.size(); j++)
currentValue = myDoubleValues.elementAt((int) j);
if (currentValue != null){
if (currentValue <= MinDouble) {
MinDouble = currentValue;
return MinDouble;
/*find the MAX value in the Hashtable to give us the range (with the MIN value)
public double MAX()
* Create an instance of StoreValuesDouble to hold vector values and number of times the values
* appear. StoreValuesDouble automatically contains the variables defined above
* (myDoubleValues, myValues and nullValues) we have to initialise myDoubleValues and myValues
* as they have been defined but not initialised. nullValues has been defined (int) and initialised (0).
* @param Vector /<Double/> a vector holding Double values
* @param inValues the values in the vector
* @return
public StoreValuesDouble(Vector<Double> inValues) {
myDoubleValues = inValues; //the attribute myDoubleValues defined in the StoreValuesDouble class
//is the inValues parameter, this allows us to store the Vector in inValues
myValues = new Hashtable<Double, Double>(); // create an instance of/initialise Hashtable
* Now define the methods to make the instance StoreValuesDouble do what we want it to do
* (ie parse all the double values of the myDoubleValues Vector attribute.
public void computeDoubleValues() {
Double currentDouble;//local variable to store the current read Double object
* Use a for loop to read through all the values contained in the vector
for (double i = 0; i < myDoubleValues.size(); i++) {
currentDouble = myDoubleValues.elementAt((int)i);
//currentDouble is now the Double object stored at i
//to check that i is not null we use the if statment
if (currentDouble != null) {
//i is not null so we want to add it to the hashtable. Rather than writing a lot of code
//here to do checking and adding we just call a method that can be written seperately
updateDoubleTable(currentDouble);
else {
//i is null so we just count it by adding it to our nullValues attribute
nullValues++;
* Update the current distribution of Doubles
* @param Double for the value of the key
* @param inDouble for the value entered into the Hashtable (the object)
public void updateDoubleTable(Double inDouble) {
//First test that variable inDouble is not null
if (inDouble != null) {
//update the table myValues this involves two tasks
//1)see if the double object has already been seen
//so we create a local variable to test the Hashtable
boolean alreadyPresent;
alreadyPresent = myValues.containsKey(inDouble);
//here we check whether inDouble is already in myValues
if (alreadyPresent) {
//if it is present we need to increase the counter
Double counter = myValues.get(inDouble);
//local variable counter to get the value associated to the key inDouble
Double newCounter = new Double(counter.intValue() + 1.0);
//update counter values and then ...
myValues.put(inDouble, newCounter);
//put into myValues
//as Hashtable can store only Objects, we cannot use primitive types
// so we use Objects related to primitive types as Integer, Float, Double
// or Boolean (here, we use Double)
} else {
//store the double and set it's counter to 1
myValues.put(inDouble, new Double(1));
} else {
//do nothing
//now we want to display the values
public void displayDoubleTable() {
// to display the distribution, we need to parse all the keys of the
// hashtable and access to the value associated to each key
Enumeration<Double> keys = myValues.keys();
Double currentKey;
Double currentValue;
System.out.println("");
System.out.println("Hashtable Information:");
System.out.println("");
System.out.println(myDoubleValues.size() + " Double objects in initial vector");
System.out.println("");
while (keys.hasMoreElements()) {
currentKey = keys.nextElement();
currentValue = myValues.get(currentKey);
System.out.println("The value " + currentKey.doubleValue()
+ " has been seen " + currentValue.doubleValue()
+ " time(s) in the initial Vector");
System.out.println("");
System.out.println("There were " + nullValues
+ " null Double object(s) in the inital Vector");
}As part of the StoreValuesDouble class. And to display it.
package statistics;
import java.util.Vector;
public class TestStatDouble {
static Vector<Double> doubleVector;
* Create and initialise a vector of values and compute the mean,
* standard deviation, distribution and MIN/MAX values.
public static void main(String[] args) {
// initialise the values in initValues
initValues();
// create an instance of StoreValuesDouble taking double as the parameter
StoreValuesDouble is = new StoreValuesDouble(doubleVector);
//Display the results
displayVectorContent(doubleVector);
System.out.println("");
System.out.println("Number of null values: " + is.getDoubleNull());
System.out.println("Number of non-null values is: " +(is.getDoubleValues() - is.getDoubleNull()));
System.out.println("Number of all values: " + is.getDoubleValues());
System.out.println("The mean is: " + is.meanDouble());
System.out.println("Standard deviation is: " + is.standardDeviationDouble());
System.out.println("The lowest value is " + is.MinDouble());
System.out.println("");
* now I want to display the results from the displayTable method in the StoreValuesDouble
* class so I create an instance of StoreValuesDouble and use the computeDoubleValues and
* displayDoubleTable methods.
StoreValuesDouble storeValues = new StoreValuesDouble(doubleVector);
storeValues.computeDoubleValues();
storeValues.displayDoubleTable();
* create the class method initValues() to add values to the Vector doubleVector
public static void initValues()
doubleVector = new Vector<Double>();
doubleVector.addElement(null);
doubleVector.addElement(new Double(10.9));
doubleVector.addElement(new Double(15.95));
doubleVector.addElement(new Double(17));
doubleVector.addElement(null);
doubleVector.addElement(new Double(1));
doubleVector.addElement(new Double(4));
doubleVector.addElement(new Double(10.499));
doubleVector.addElement(null);
doubleVector.addElement(new Double(10.4999));
doubleVector.addElement(new Double(17));
doubleVector.addElement(new Double(-15));
doubleVector.addElement(null);
doubleVector.addElement(new Double(14));
doubleVector.addElement(new Double(20));
doubleVector.addElement(new Double(-3));
doubleVector.addElement(null);
doubleVector.addElement(new Double(9));
doubleVector.addElement(new Double(1.5));
doubleVector.addElement(null);
doubleVector.addElement(new Double(10.22));
doubleVector.addElement(new Double(15.23));
doubleVector.addElement(new Double(17.91));
doubleVector.addElement(null);
* class method to print values contained in the vector doubleVector to the console.
* @param doubleVector the Vector to be displayed
public static void displayVectorContent(Vector doubleVector)
Double currentDouble;
System.out.println("Double values within the Vector:");
for (int i=0; i<doubleVector.size();i++)
try
currentDouble = (Double) doubleVector.elementAt(i);
if (currentDouble != null)
System.out.print(currentDouble.toString() + " ");
catch(ClassCastException cce)
System.out.print(cce.getMessage() + " ");
cce.printStackTrace();
System.out.println("");
It compiles fine but when I try and run it I get a
Exception in thread "main" java.lang.NullPointerException
at statistics.StoreValuesDouble.MinDouble(StoreValuesDouble.java:139)
at statistics.TestStatDouble.main(TestStatDouble.java:37)
TestStatDouble 37 is
System.out.println("The lowest value is " + is.MinDouble());139 is
if (currentValue <= MinDouble) {I guess the problem's in my if loop but I'm not sure why. Any help would be appreciated.
Message was edited by:
Ali_DCouple of points about your code:
1. Don't declare your instance variables as solid types, declare them using their interfaces (where applicable), so in your case don't specifiy that you are using Vector or Hashtable, use List and Map. This will allow you to easily change your code to use a different collection, if and when appropriate. Also the unnecessary overhead of Vectors synchronisation means that you should use ArrayList instead of vector (that means that you will have to use get(int) instead of elementAt() but that's a very small price to pay.
2. Declare local variables as close to their point of usage as possible. (Unless you need to do this for your course work, in which case you don't have a choice).
3. Use the appropriate data type. For your count of null values you should be using an int or a long (you can't have a fractional count value!) Also, this should have been obvious to you, when you had to cast the value to an int for use with your lists. (Using double as an index is a very bad idea... And before you go posting the question, do a search on why floating point precision may not give you the results you expect)
4. Code defencively... e.g. in your meanDouble() method, you set nonNull to 0, and then you do a division using that value. What do you think is going to happen if your loop doesn't execute once? Division by zero... You should handle these cases, rather than letting them fail ignominiously.
5. If you are doing code like this... if (currentDouble != null) {
// / nothing to do
} else {
nbNull++;
} Why have the empty block? You should just do the inverse.
if (currentDouble == null) {
nbNull++;
} Far simpler, and expresses exactly what you are trying to do, not what you are not trying to do.
6. Enumeration --- What version of java is that course being run in? I can see that you are using autoboxing, so it has to be 1.5 so, WHY is your lecturer encouraging the use of Vectors, Hashtables, and Enumerations!?!?!
Anyway, that should be enough to be going on with. -
Issue using extractval to get the node value when there is namespace
I created the db with a XMLType column:
CREATE TABLE mytable1 (key_column VARCHAR2(10) PRIMARY KEY, xml_column1 XMLType);
Then inserted one row:
INSERT INTO mytable1 (key_column,xml_column1) VALUES ('test', XMLType('<MY_TEST xmlns="http://xmlns.oracle.com/ku" version="1.0">
<SCHEMA>SYSTEM</SCHEMA>
<NAME>TABLE41</NAME>
<TEST_GROUP>TEST_GRP_RMP</TEST_GROUP>
<TEST_NAME>DEPARTTEST</TEST_NAME>
<FUNCTION_SCHEMA>SYSTEM</FUNCTION_SCHEMA>
<TEST_FUNCTION>EXCLUDE_TABLE</TEST_FUNCTION>
<STATEMENT_TYPE_LIST>
<STATEMENT_TYPE_LIST_ENTRY>
<NAME>SELECT</NAME>
</STATEMENT_TYPE_LIST_ENTRY>
</STATEMENT_TYPE_LIST>
<UPDATE_CHECK>Y</UPDATE_CHECK>
<ENABLE>Y</ENABLE>
<STATIC_POLICY>N</STATIC_POLICY>
<TEST_TYPE>DBMS_RLS.DYNAMIC</TEST_TYPE>
<LONG_PREDICATE>N</LONG_PREDICATE>
</MY_TEST>'));
Then I ran:
select extractValue(xml_column1,'MY_TEST/TEST_NAME') policy from mytable1;
There is nothing returned.
If i do not have "xmlns="http://xmlns.oracle.com/ku" " in MY_TEST node, then the correct value returned.
Please advise how could I get the node value when there is namespace? Thanks.This is a known issue. In the third parameter of extractvalue, set the namesapce. Then it works.
-
Finding the largest value...
Hi guys,
I'm creating a method where it finds the largest value in a list of integers, using a loop. When it finds it, it's stored in the "max" and returns the "max".
Here's the code...
public Integer findMax()
List<Integer> list = Arrays.asList(4,8,2,10,24);
int max = 0;
for(Integer i = 0 ; i < list.size() ; i++) {
if(max == list.get(i))
max = i;
return max;
}It complies, but when i run it, it doesn't actually get the largest value (which should be 24). It's still 0 when i Inspect it.
Does anybody know where i'm going wrong with this?Well i went through the method and it seems to be printing 0 five times...
public Integer findMax()
List<Integer> list = Arrays.asList(4,8,2,10,24);
int max = 0;
for(Integer i = 0 ; i < list.size() ; i++) {
if(max >= list.get(i))
max = list.get(i);
System.out.println(max);
return max;
}After looking looking through the API, i used the length, instead of size, but when i compile the program it says it can't find the method. Do you know what else i have to change or add in the code for it to compile?
DrClap wrote:
if(max == list.get(i)) Can you explain, in words, what this comparison was meant to do?I've edited that, because that's wrong.
Maybe you are looking for
-
My Lacie hard drive back up is not showing up and light is flickering
My back up hard drive is not showing up when i plug in the USB to my Macbook Air so won't back up. The light on the hard drive is flickering. CAn you please help?
-
I have no idea what the password is to use the wlan-17d6 wi-fi?
how do i find the password for wlan-17d6 wi=fi?
-
DPM 2012 R2 (ID 104 Details: Internal error code: 0x809909FF)
We are running DPM 2012 R2 on Windows Server 2012 R2 We have a Protection Group:Servers (9 members) where 5 servers always give the same error message, when we try to run a synchronization job with consistency check. With other 4 server everything is
-
Unable to get help with Broken car compuer module item purchased from seller.
Hi, I am having issue with an item that I purchased march 15. The item I purchased was a bmw car light module computer which controls the light. On march 20th my machanic installed the part to my car and it over heated so, I contacted the seller on m
-
Pls help with extracting dates
I wish to produce the output in table customer1 based on the customer table DOP field. The values in DOP (0030500) indicates wed and fri, (0000007) indicates sunday. how can i extract all the dates for wed and fri (0030500) between the period ST_DT a