Forum Discussion
Testimonyman
12 years agoNew Contributor
Ok, some update, I was able to add an array to a groovy script containing the entries I had in an excel so basically e.g
def MAX_SIZE = 31
def myArray = new Object[MAX_SIZE]
// Code array
myArray[0] = "EU1234qSP"
myArray[1] = "ES1234qSPwe"
myArray[2] = "EF1234qSPde"
myArray[3] = "EW1234qSPpt"
Then I have expanded the properties Xpath from the web service response that returns the code from the data base. e.g:
def OfferCode1 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[1]/SubsPlanCode[1]}' )
def OfferCode2 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[2]/SubsPlanCode[1]}' )
def OfferCode3 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[3]/SubsPlanCode[1]}' )
def OfferCode4 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[4]/SubsPlanCode[1]}' )
What is the best approach to compare them and print that there is a match or fail?
A loop? or any other way?
still a beginner at this, can anyone help?
Cheers
Adi
def MAX_SIZE = 31
def myArray = new Object[MAX_SIZE]
// Code array
myArray[0] = "EU1234qSP"
myArray[1] = "ES1234qSPwe"
myArray[2] = "EF1234qSPde"
myArray[3] = "EW1234qSPpt"
Then I have expanded the properties Xpath from the web service response that returns the code from the data base. e.g:
def OfferCode1 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[1]/SubsPlanCode[1]}' )
def OfferCode2 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[2]/SubsPlanCode[1]}' )
def OfferCode3 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[3]/SubsPlanCode[1]}' )
def OfferCode4 = context.expand( '${QuerySubsPlanList - Request 1#Response#declare namespace ns=\'http://com.ztesoft.zsmart/xsd\'; //ns:QuerySubsPlanListResponse[1]/SubsPlanDtoList[1]/SubsPlanDto[4]/SubsPlanCode[1]}' )
What is the best approach to compare them and print that there is a match or fail?
A loop? or any other way?
still a beginner at this, can anyone help?
Cheers
Adi