Update supportLanguageId failes

lock
push_pin
done
Answered
4

Hi,

I'm trying to update supportLanguageId for contacts according to below SearchEngine

SearchEngine se1;
se1.bypassNetServer(true); 
se1.addData("person.supportLanguageId","2");
se1.addCriteria("person.contact_id.userdef_id.string01", "OperatorBeginsWith", "K");
se1.addCriteria("person.supportLanguageId", "OperatorEquals", "0");
se1.update();

It gives me below error, If I do an execute I get a list of contacts. I have tried removing bypassNetServer but i didn't help either.

Any ideas how to solve this?

Thanks!

25 May 2023 | 01:27 PM

All Replies (4)

Hi Johan

It's your "person.contact_id.userdef_id.string01" line that causes the exception. I don't think SearchEngine likes doing updates while doing joins.

25 May 2023 | 01:58 PM
Thanks for this! solved it by doing two searches.
26 May 2023 | 06:29 AM

Espen is correct.

You could do something like this:

SearchEngine se;
se.bypassNetServer(true);
se.addField("person.person_id");
se.addCriteria("person.contact_id.userdef_id.string01", "OperatorBeginsWith", "K");
se.addCriteria("person.supportLanguageId", "OperatorEquals", "0");
for(se.select(); !se.eof(); se.next())
{
  SearchEngine se1;
  se1.bypassNetServer(true); 
  se1.addData("person.supportLanguageId","2");
  se1.addCriteria("person.person_id", "Equals", se.getField(0));
  se1.update();
}
26 May 2023 | 06:32 AM
Thanks! This is what I ended up doing after Espens comment.
26 May 2023 | 06:54 AM

Add reply