Count of users in one group - opendj

Is it possible to get count of users in one group with opendj sdk?
e.g. my group has multi-values UniqueMember attribute, but is it possible that I get the count of the UniqueMember? because I don't want to list all the users, just to get the count.
Thanks

Unfortunately, there is no standard in LDAP to retrieve the number of values of an attribute of a given entry.

Related

MS Graph groups API : Request_ResourceNotFound when only filtering on id

When I send this query to Graph:
https://graph.microsoft.com/v1.0/groups?$filter=id eq '8bd1ac2d-7cbf-4316-8f5d-0819179f4cff'
And the group exists, I get an array with 1 group.
But the same query with an id that does not exist, I get this error : Request_ResourceNotFound
How come I don't get an empty array ?
How should I test if the group exists without getting an error ? I work in Power Automates.
Thanks,
There is no way to get the empty array as the result of graph API if the group id is not exist.
Its always return the Request_ResourceNotFound."Resource 'xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' does not exist or one of its queried reference-property objects are not present.",
For workaround you can use the List groups graph API to get the list of groups.
And then compare the group id in the list.

Get a random record list Dynamics 365 c#

I'm new to Dynamics 365 development. I have an activity where I need to select a certain number of random records in an entity, it would be like a prize draw from a list of records. I will be working with many records. How to best do this in C#?
There isn't a built-in functionality to get a random record, one approach (probably is not the fastest one) is to retrieve all the records first, if you are using C# you can do a RetrieveMultiple (keep in mind that you need pagination if the records are more than 5000) with just the Id (so ColumnSet can be false).
After you retrieved the Ids you can put them in a List and access (randomly) the elements you need (check this link as an example How to access random item in list?).
Building on Guido's answer, another idea would be to get the minimum CreatedOn and maximum CreatedOn for the records in question. Then generate a random date and time within that range (inclusive of the min and max).
To get the random record, query for the top 1 where CreatedOn is greater than the random date, order by CreatedOn.
Or, if you count the records first, you can generate a random number in that range and do a LINQ query with Skip(random #).Take(1).

Make a group by with a where in statement Laravel

I am writing a little script to load an Attendee_logs, based that counts the total of prints for based on the hour.
First I load the id's from the attendees
$allAttendees->pluck('id')->implode(',')
So I get 389832, 321321 from this (this are the id's from the attendees, based on a group).
Now I want to group them by the hour.
But I cannot find out how I add the whereIn statement
$badgesPrintedByDate = DB::table('Attendee_logs')->select(DB::raw('hour(created_at)'), DB::raw('COUNT(id)'))->whereIn('id', [$allAttendees->pluck('id')->implode(',')])->groupBy(DB::raw('hour(created_at)'));
When I do it like this, I get an empty result.
But when I remove the whereIn I get a result.
So my question, How can I count the rows based on the Hour and where I also give the ID's with it :)?
I think this is gonna work:
$badgesPrintedByDate = DB::table('Attendee_logs')->select(DB::raw('hour(created_at)'), DB::raw('COUNT(id)'))->whereIn('id', $allAttendees->pluck('id')->all())->groupBy(DB::raw('hour(created_at)'));
Instead of saying:
$allAttendees->pluck('id')->all()
Which returns an array of ids, you can also say:'
$allAttendees->pluck('id')->values()
Or:
$allAttendees->pluck('id')->toArray();

Crystal: Sort by multiple groups

Good afternoon all;
Currently I have a crystal report that displays as such;
{ReceivingHospital}
{CallTtype} {Date} {SendingHospital} {Time1} {Time2}
I would like it to break down by receiving hospital then beneath that show all "Major" call types and sum them. Then Beneath that all "Moderate" call types with a sum, and then all "Minor" call types beneath that with a sum also. And, I want to keep all the associated details listed in that same order. I was thinking I could add multiple group headers and place the call type in that, but that does not seem to be working.
Any ideas would be greatly appreciated.
first, you need to create a group for {ReceivingHospital} and then a second group for {CallType}. You can then create a group sum based on {CallType}. If it still does not work and you are working with multiple tables you should check whether you have joined your tables correctly.

Finding all items before a certain item in mongomapper

I want to find all items before a certain item in mongomapper.
For example if I have five User classes saved and I pass in the ID of user 3 then I expect to get back the first two items.
Any ideas how to do this efficiently?
The ObjectID key in Mongo is comprised of a few things, one of them being a timestamp. You can probably use that as a condition on which to query. Look here for more details, http://mongotips.com/b/a-few-objectid-tricks/

Resources