API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Missing function EmployeeGroup_GetNextAvailableNumber()


I am missing a function like: EmployeeGroup_GetNextAvailableNumber()

How can I get the last available employee group number in a smart way?
created Nov 14, 2012 by Jens Kirk
14% Accept Rate
Q 15 A 9 C 7

4 Answers

Hi Jens,

I am afraid there is no smart way of finding the next available number for an employee group (besides grabbing all of them, finding the highest number and adding 1).

If you do what is described above I recommend only doing it once and keeping a local field for the value (given that employee groups are only created through your integration)
answered Nov 15, 2012 by nkn
Do you have a function (code example) for what you just described?
answered Nov 15, 2012 by Jens Kirk
Not in PHP - but I could cook up a C# example if that would work?
answered Dec 7, 2012 by nkn
This works:

$nextNumber = max($soap_client-EmployeeGroup_GetAll()-EmployeeGroup_GetAllResult-EmployeeGroupHandle)-Number + 1;

UPDATE: It does not work if you have no existing employees.
answered Feb 5, 2013 by Jens Kirk
edited Mar 21, 2013 by Jens Kirk
Visma e-conomic A/S