on 07-06-2013 2:39 AM
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
Hi Rakesh,
You need to define one function for JavaScript , for example getCardCode().
var cardcode = $.request.getParameter('CardCode');
Finally, you replace hard coding part use variable (cardcode).
you request URL ,such as http://youroriginalpath?CardCode='12345'.
Hope this can help you.
Regards,
Jerry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.