Skip to Content

Error when executing XSJS through XSJOB

Dear All,

I created xsjs (with the logic below) which works perfectly fine in browser.

But when I wrap the same logic in a function and execute it in xsjob, I receive an error at the last line in the below code - "Error: $.hdb.Connection.executeQuery: Parameter at position 2 is undefined which is not allowed".

Can you please suggest /advise on how to correct the error please ?

Thanks

Hari

var jobtyp = "T-001";
var company = "ART1";

var d 	= new Date();
var year = d.getFullYear();
var month = ('0' + (d.getMonth()+1)).slice(-2);
var date  = ('0' + d.getDate()).slice(-2);
var period = year + month;
var connection = $.hdb.getConnection();

var sqlstr    = "SELECT IND, PRD_ID, SCHD_DAY FROM \"<shema name>\".\"<Table Name>\" WHERE PRD_ID =? AND COMPANY = ? AND JOB_TYP = ?" ;
var exec      =  connection.executeQuery(sqlstr,period,company,jobtyp);
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 02, 2017 at 02:38 PM
    -1

    make sure your variables are set when you pass them to the function.

    based on the error, as it states, it does not seem to be set prior to using it.

    what is the code you have when you wrap this in a function? make sure the scope is ok

    Add comment
    10|10000 characters needed characters exceeded