Hi friends,
I have a doubt regarding extended application service. kindly advise
I have this small code(PDF.xsjs) working with hard coded values, but I want to turn it into run time parameters but that run time parameters is a should be in the form of dropdown box from the database. Can some one suggest, where I should modify the code. Can It work independently or does it require the complete view.xsjs, controller.xsjs to take the run time parameter instead of 12345 the value should be listed in the drop down for the user(value is from database). Please help me I am stuck.
function createEntry(rs)
{
return {
"Cardcode" : rs.getString(1),
"CardName" : rs.getString(2)
};
}
try {
var body ='';
var list =[];
var query = "Select \"CardCode\",\"CardName\" From \"SCHEMA\".\"TABLE\" WHERE \"CardCode\" ='12345'";
var conn = $.db.getConnection();
$.trace.debug(query);
var pcall = conn.prepareCall(query);
pcall.execute();
var rs = pcall.getResultSet();
while(rs.next())
{
list.push(createEntry(rs));
$.response.headers.set("Content-Disposition", "Content-Disposition: attachment; filename=CardName filename = CardType");
}
rs.close();
pcall.close();
conn.close();
body = JSON.stringify({
"entries" : list
});
$.response.contentType = 'application/json; charset=UTF-8';
$.response.setBody(body);
$.response.status = $.net.http.OK; }
}
catch (e)
{
$.response.setBody("Error while retrieving : "+e);
$.response.status = 500;
}
conn.close();
Waiting for reply pls
Thanks