cancel
Showing results for 
Search instead for 
Did you mean: 

export employee

former_member630291
Participant
0 Kudos

Hi, I want to export all employees with admingroup. Step by step process please.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Ashish,

The answer from will export all employees (just a small typo in his query, the character ' (single quote) needs to be removed.

In case you wish to export all employees who belong to admingroup, then you need a couple of joins since the 'groups' is an attribute defined via a m:n relation.

 INSERT_UPDATE Employee;uid[unique=true];name;
 "#% impex.exportItems(""select {emp.PK} from {Employee as emp JOIN PrincipalGroupRelation as rel ON {emp.PK} = {rel.source} JOIN PrincipalGroup as pg ON {rel.target}={pg.PK}} WHERE {pg.uid}='admingroup'"", Collections.EMPTY_MAP, Collections.singletonList( Item.class ), true, true, -1, -1 );"
 

Hope this helps

Best

Shanmugaraja

Former Member
0 Kudos

Hi Shanmugaraja

My script was an "example" which he should adapt on his usecase. 😉

0 Kudos

Hi Patrick, Yes of course, it was more than clear. I was only trying to let him know. Apologies if you thought otherwise :-)

former_member630291
Participant
0 Kudos

Hi Shanmugaraja, Could you help me understanding this as well so in future if I need to perform join operations I can handle that too?

Answers (2)

Answers (2)

former_member630291
Participant
0 Kudos

Thank you very much Shanmugaraja

Former Member
0 Kudos

4 simple steps:

  1. Go to admin console

  2. Create your flexible query, try it out on admin console > Console > FlexibleSearch

  3. Create export script

  4. Run export script admin console > Console > Impex Export

Example export script:

 INSERT_UPDATE Employee;uid[unique=true];name;
 "#% impex.exportItems(""SELECT {pk} FROM {Employee}"", Collections.EMPTY_MAP, Collections.singletonList( Item.class ), true, true, -1, -1 );"