Quantcast
Viewing all articles
Browse latest Browse all 8627

Re: How to get a query row count

Well in my case here,s what I did

 

I used a select statement

 

var ID=1;// set to 1 because in needed to use it for the next ID , this is not safe but just for fun

 

 

var conn = $.db.getConnection();

conn.prepareStatement("SET SCHEMA \"SYSTEM\"").execute();

//get ID

var pstmt = conn.prepareStatement(

  "select * from \"SYSTEM\".\"MYTABLE\""

);

 

 

var rs = pstmt.executeQuery();

if(!rs.next())

  {

 

  body = "Failed Reteiving  attribute view";

  $.response.addBody(body); 

  }

else{

  while (rs.next())

  {

  ID++;

  }

}

 

.......

 

So you the ID value you can print out by attaching to a body tag or however you deem fit

 

the above code was done on a Severside .xsjs file


Viewing all articles
Browse latest Browse all 8627

Trending Articles