on 10-09-2008 10:06 AM
Hi,
I have to fetch 3 values and populate it to the 3 fields in the target. The UDF am using is as attached. This UDF is for fetching one value. Kindly tell me about the changes I will have to make to fetch 3 values instead of 1 value.
String Query = " ";
Channel channel = null;
DataBaseAccessor accessor = null;
DataBaseResult resultSet = null;
// Query to retrieve the PROP value for the particular source value passed.
Query ="Select PROP from TANKS where ID='" + ID[0] + "' ";
try{
//Determine a channel, as created in the Configuration
channel = LookupService.getChannel("<Business Service>","<Communication Channel>");
//Get a system accessor for the channel. As the call is being made to an DB, an DatabaseAccessor is obtained.
accessor = LookupService.getDataBaseAccessor(channel);
//Execute Query and get the values in resultset
resultSet = accessor.execute(Query);
for(Iterator rows = resultSet.getRows();rows.hasNext();){
Map rowMap = (Map)rows.next();
result.addValue((String)rowMap.get("PROP"));
}
}
catch(Exception ex){
result.addValue(ex.getMessage());
}
finally{
try{
if (accessor!=null) accessor.close();
}
catch(Exception e){
result.addValue(e.getMessage());
}}
Edited by: SNIGDHA TRIVEDI on Oct 9, 2008 11:06 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Query ="Select PROP from TANKS where ID='" + ID[0] + "' ";
change this
Query ="Select PROP, Field2, Field3 from TANKS where ID='" + ID[0] + "' "
result.addValue((String)rowMap.get("PROP"));
result.addValue((String)rowMap.get("Field2"));
result.addValue((String)rowMap.get("Field3"));
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> Query ="Select PROP from TANKS where ID='" + ID[0] + "' ";
>
Change this query to fetch your three values. Like PROP, Var1 and Var2.
> result.addValue((String)rowMap.get("PROP"));
Add statements here for Var1 and Var2 in to two local string variables.
Then manipulate them as you want to pass them to the target elements.
VJ
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 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.