on 02-21-2019 8:58 PM
flexibleSearchService.search(/SELECT {pRef:PK} FROM {Product AS p}, {ProductReference AS pRef} WHERE {p:catalogVersion}=
({{
SELECT {PK} FROM {catalogVersion} WHERE {catalog}=
({{
SELECT {PK} FROM {catalog} WHERE {id}='electronicsProductCatalog'
}}) AND {version}='Staged'
}}) AND ({p:PK}={pRef:source} OR {p:PK}={pRef:target})/).result.each {modelService.remove it}
On executing the groovy script given above, I am getting the following error :
Script execution has failed [reason: java.lang.IllegalArgumentException: Parameter 'model' is null!]
Interestingly, it works for single or multiple product codes mentioned explicitly e.g. the following code executes successfully:
flexibleSearchService.search(/SELECT {pRef:PK} FROM {Product AS p}, {ProductReference AS pRef} WHERE {p:catalogVersion}=
({{
SELECT {PK} FROM {catalogVersion} WHERE {catalog}=
({{
SELECT {PK} FROM {catalog} WHERE {id}='electronicsProductCatalog'
}}) AND {version}='Staged'
}}) AND ({p:PK}={pRef:source} OR {p:PK}={pRef:target}) AND {p:code} IN('2053226','4786113')/).result.each {modelService.remove it}
Similarly, the following code too executes successfully:
flexibleSearchService.search(/SELECT {pRef:PK} FROM {Product AS p}, {ProductReference AS pRef} WHERE {p:catalogVersion}=
({{
SELECT {PK} FROM {catalogVersion} WHERE {catalog}=
({{
SELECT {PK} FROM {catalog} WHERE {id}='electronicsProductCatalog'
}}) AND {version}='Staged'
}}) AND ({p:PK}={pRef:source} OR {p:PK}={pRef:target}) AND {p:code}='4786113'/).result.each {modelService.remove it}
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.