on 12-11-2008 8:42 AM
Hi all
I am performing simple jdbc lookup in PI 7.0.
For JDBC lookup i am follwing link
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
i am able to retrieve the values using the
following
..
.
Query = "SELECT EMP_NO FROM EMPLOYEE WHERE
EMP_NAME = 'abc' " ;
.
.
.
and display the values using
.
.
result.addValue("" + rowMap.get("EMP_NO"));
.
.
.
.
but when i am trying to get the max value of
EMP_NO using the following it is giving null
value ?
Query = "SELECT MAX(EMP_NO) FROM EMPLOYEE" ;
.
.
.
.
result.addValue("" + rowMap.get("EMP_NO"));
.
.
.
.
how to test whether the query has any value and
how to display the respective value?
kindly provide with a solution.
Regards
uday
Try this
Query = "SELECT MAX(EMP_NO) Max_Emp_No FROM EMPLOYEE" ;
and after this :
.
.
.
.
Call as
+result.addValue("" + rowMap.get("Max_Emp_No"));+
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Antony
Thank u very much u solution of replacing emp_no with MAX(emp_no) while displaying using result set .addValue worked
i replaced :result.addValue(""+rowMap.get("EMP_NO" ));
with result.addValue(""+rowMap.get("MAX(EMP_NO)" )); it works
it gives u the max value of emp_no from the table
Once Again Thank u very much
Regards
Uday
Hi all
As i said i am able to fetch the data from the database for the EMP_NO when the following combination is used for selection and display:
Query = "SELECT EMP_NO FROM EMPLOYEE WHERE EMP_NAME = 'abc' " ;
+result.addValue("" + rowMap.get("EMP_NO"));+
But when i am trying to fetch Max(EMP_NO) and display it using
Query = "SELECT MAX(EMP_NO) FROM EMPLOYEE" ;
and after executing i am using this code:
if (!resultSet.equals ( null ))
result.addValue("true0");
and it returns value true0
means there is some value in result
but when i am trying to display it using same
+result.addValue("" + rowMap.get("EMP_NO"));+
it is displaying "null"
meaning problem in displaying it .
Am i getting it properly?
HI Arpil
tried ur solution
but it is giving exception.
can anyone plz help me and provide me with a solution
Regards
uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the blog, the code is:
for(Iterator rows = resultSet.getRows();rows.hasNext();){
Map rowMap = (Map)rows.next();
result.addValue((String)rowMap.get("URole"));
Maybe try with this...
for(Iterator rows = resultSet.getRows();rows.hasNext();){
Map rowMap = (Map)rows;
result.addValue((String)rowMap.get("URole"));
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your Field name EMP_NO same as database field name?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Try typecasting this
result.addValue("" + rowMap.get("EMP_NO"));
as result.addValue("" + (String) rowMap.get("EMP_NO")); to add result list.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI veer
This solution did not work still it returns null value .
to check whether after query is executed whether result cantains any value i tried this
...
...
resultSet = accessor.execute(Query);
if (!resultSet.equals ( null ))
result.addValue("true0");
..
it returns me 'true0" in display queue but later when it executes this statement
......
result.addValue("" + rowMap.get("EMP_NO"));
.......
it gives null value what could be the problem ?
Regards
uday
Check EMP_NO field type.Check same Sql query from database,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.