Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Error in .xsjs while passing value from views

$
0
0

Hi All,

 

I am trying to pass the value from javascript view to .xsjs. When i run the .xsjs file its showing me an error:

 

PreparedStatement.setInteger: expected int for second argument, but got: string

 

Here is my code for view, controller and .xsjs:

 

 

View.js

 

 

var YearBtn = new sap.ui.commons.Button("TabBtnYear",{

  //text : "Year",

  //tooltip : oBundle.getText("t_edit"),

  press : function(oEvent){

         var DDYear=FDropDown.getLiveValue();

               oController.onTBPress(oEvent,oController,DDYear);

               sap.ui.getCore().byId("TtopSalesCompanyBarChart").getModel().refresh(true);

               alert("TEST"+DDYear);

              

               }

  });

 

Controller.js

 

onTBPress:function(oEvent,oController,DDYear){

   

   

  var aUrl = '/p1054871trial/dev/textxsapp/services/salesOrderService.xsjs?cmd=delete'+'&DDYear='+escape(DDYear);

  jQuery.ajax({

        url: aUrl,

        method: 'GET',

        dataType: 'text',

        success: function(myTxt){

            alert("SUCCESS");

           oController.refreshForm();

   

    //var test = sap.ui.getCore().byId("TtopSalesCompanyBarChart").getValue();

    //alert("TEST REFRESH"+test);

    //var datachart = test.getModel();

    //alert("datachart"+datachart);

    //sap.ui.getCore().byId("TtopSalesCompanyBarChart").getModel().refresh(true);

    alert("999999");

   // TtopSalesCompanyBarChart

             //oController.onDeleteSuccess(myTxt,oController);

             },

        error: oController.onErrorCall });

  },

  

onErrorCall: function(jqXHR, textStatus, errorThrown){   

                     sap.ui.commons.MessageBox.show(jqXHR.responseText,   

                                         "ERROR",  

                                         "Error in calling Service" );   

                    return;  

  

},

 

.xsjs

 

var DDYear = $.request.parameters.get('DDYear');

 

var select_all_sales_orders_query =                    

                    "SELECT CUST_SOURCE_DIM_KEY, COUNT(CUSTOMER_DIM_KEY) " +

                    "FROM H_CUSTOMER_MEMBERSHIP " +

                    "WHERE CUST_SOURCE_DIM_KEY IS NOT NULL AND YEAR(MEMBER_JOINED_DATE) = ? " +

                    "GROUP BY CUST_SOURCE_DIM_KEY";

 

var body = '';

  

   //alert("inside funtion"+YEAR2);

          var salesOrdersList = [];

          var connection = $.db.getConnection();

          connection.prepareStatement("set schema NEO_9KLD6P4XR4OT4FZ1SIL3WGR7K").execute();

         // $.trace.debug("YEAR");

          //connection.prepareStatement(schema).execute();

          var statement = null;

          var resultSet = null;

          try{

                    statement = connection.prepareStatement(select_all_sales_orders_query);

                    //alert(YEAR2);

            statement.setInt(1,DDYear);

                    resultSet = statement.executeQuery();

                    var salesOrder;

                    while (resultSet.next()) {

                              salesOrder = {};

                              salesOrder.cust_source_dim_key = resultSet.getString(1);

                              salesOrder.customer_dim_key = resultSet.getDouble(2);

                              //salesOrder.gross_amount = resultSet.getDouble(3);

                              salesOrdersList.push(salesOrder);

                    }

          } finally {

                    close([resultSet, statement, connection]);

          }

          return salesOrdersList;


Viewing all articles
Browse latest Browse all 6412

Trending Articles