How to make script-based selections? Need a hint...

Hi, I cannot find any examples in how to make a script-based selection. I would need an example.

There is no help about this in the documentation and all I get when starting a new script-based selection is the follwing code:


I have tried adding a SerachEngine query but I have no idea how to present the information in the result pane.

Re: How to make script-based selections? Need a hint...

The function execute() should contain the SearchEngine doing the actual search, and return the number of hits.

The function getIds() should return the ids (for the chosen table), which is a result of your SearchEngine. You do not need to care about presentation. That is taken care of by the selection system.

The call sequence is 1) execute(), 2) getIds().
So you should probably move the line "Integer[] ids;" out to be a global variabel, and the populate it inside the execute() function.

regards
Stian Andre Olsen
SuperOffice AS

By: Stian Andre Olsen 21 Dec 2010

RE: How to make script-based selections? Need a hint...

Could someone give a simple example for this ?

Im struggling.

By: Ummair Tahir 4 Dec 2014

RE: How to make script-based selections? Need a hint...

Got something: 

#setLanguageLevel 2;

Integer[] ids;

Integer execute()
{
  Integer count = 0;

  SearchEngine se;

  se.addField("contact.id");

  for (se.execute(); !se.eof(); se.next())
  {
    ids.pushBack(se.getField(0).toInteger());

    count++;
  }

  return count;
}

Integer[] getIds()
{

  return ids;
}
By: Ummair Tahir 4 Dec 2014