Forum Stats

  • 3,838,954 Users
  • 2,262,428 Discussions
  • 7,900,816 Comments

Discussions

UCM RIDC Reusing Binders for Multiple Requests return same row everytime.

User_X7PE2
User_X7PE2 Member Posts: 16 Blue Ribbon

I am using the below code to fetch records using multiple request.

binder.putLocal("IdcService", "GET_SEARCH_RESULTS");
	      binder.putLocal("QueryText", query);
	      binder.putLocal("ResultCount", "10000");
	      binder.putLocal("StartRow", "1");
	      int count = 1;
	      DataResultSet dataSearchResults;
	     
	     while(!(dataSearchResults = this.getSearchResult(idcClient, userContext, binder)).getRows().isEmpty()) {
	    	  count += 10000;
	         binder.putLocal("StartRow", String.valueOf(count));
	         Thread.sleep(2000L);
	      }

 private DataResultSet getSearchResult(IdcClient idcClient, IdcContext userContext, DataBinder binder) throws Exception {
		 
  ServiceResponse response = idcClient.sendRequest(userContext, binder);
  DataBinder binder1 = response.getResponseAsBinder();
DataResultSet resultSet = binder1.getResultSet("SearchResults");
	      return resultSet;
	   }


For first iteration below it the parameters which returns 5 rows

ResultCount: 10000

 StartRow: 1

 UserDateFormat: iso8601

UserTimeZone: UTC

But for next iterations which are

ResultCount: 10000

 StartRow: 10001

 UserDateFormat: iso8601

 UserTimeZone: UTC


ResultCount: 10000

 StartRow: 20001

 UserDateFormat: iso8601

 UserTimeZone: UTC


ResultCount: 10000

 StartRow: 30001

 UserDateFormat: iso8601

 UserTimeZone: UTC


and so on...

I am getting a infinite loop returning the last row (5th row in result set) for every idc service call .

What can I do to stop the loop if there are no next result.

Answers