How to fetch multiple values through view criteria using groovy
Content
Hi Team,
I want to fetch a field's value through view criteria sript when the condition satisfies. As of now, I can get a single value and below is the example:
I want to get all Open SR numbers created against the customer "Chalhoub group" and set those value into a field. From the below script I can able to print only a single record but the count for the particular search is more than 20. Please guide me if anyone aware of this.
Thanks,
Shaheela
Version
21ACode Snippet
def account = "Chalhoub group" def srno = SrNumber def ServiceRequestVO = newView('ServiceRequestVO') def vc = ServiceRequestVO.createViewCriteria() def vcrRow = vc.createRow() def vcFilter1 = vcrRow.ensureCriteriaItem('AccountPartyUniqueName') vcFilter1.setOperator('=') vcFilter1.setValue(account) def vcFilter2 = vcrRow.ensureCriteriaItem('StatusCd') vcFilter2.setOperator('<>') vcFilter2.setValue('ORA_SVC_RESOLVED') def vcFilter3 = vcrRow.ensureCriteriaItem('StatusCd') vcFilter3.setOperator('<>') vcFilter3.setValue('ORA_SVC_CLOSED') vc.insertRow(vcrRow) ServiceRequestVO.appendViewCriteria(vc) ServiceRequestVO.executeQuery() int count = 0 count = ServiceRequestVO.getEstimatedRowCount() //setAttribute('ProblemDescription',count) if (ServiceRequestVO.hasNext()) { def ServiceRequestRow = ServiceRequestVO.next() def srnum = ServiceRequestRow.getAttribute('SrNumber'); setAttribute('ProblemDescription',srnum) }
Tagged:
0