cancel
Showing results for 
Search instead for 
Did you mean: 

Impex: Update query for Batchmode=true

Former Member
0 Kudos

Hi I have a table like below. I need to make the active=false for the text that has 'AA' using update impex by keeping batchmode=true

sample SQL update query: UPDATE table_name set active=false where text like '%AA%'

 __________________________
 |PK | ACTIVE | TEXT        |
 |_________________________|
 | 1 | true        | BBAABB |
 | 2 | false       | BBCCBB |
 | 3 | true        | BBAABB |
 ___________________________

Accepted Solutions (1)

Accepted Solutions (1)

andyfletcher
Active Contributor
0 Kudos

You can't do this with impex because batchmode=true expects you to set unique columns that will match exactly. You'd be better off doing it with a small Groovy script in the administration console

e.g.

 flexibleSearchService.search("select {pk} from {mytype} where {text} like '%AA%'").result.each {
   it.active = false
   modelService.save(it)
 }

(don't forget to click the ROLLBACK button to change to COMMIT or your changes won't be persisted!)

Answers (0)