Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
LDAP.SearchResult.Count
Queries number of entries in search results.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
LDAP | 6.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No |
Parameters
Parameter | Description | Example |
---|---|---|
LDAPRef | The reference number for the LDAP connection. | $ldap |
Result
Returns number or error.
Description
Queries number of entries in search results.Examples
Query number of search results:
Set Variable [$EntryCount; Value:MBS("LDAP.SearchResult.Count"; $ldap)]
Loop over search results:
# loop over entries
Set Variable [$EntryCount; Value:MBS("LDAP.SearchResult.Count"; $ldap)]
Set Field [LDAP Query::Entry Count; $EntryCount]
If [$EntryCount > 0]
Set Variable [$EntryIndex; Value:0]
Loop
# get info for entry
Set Variable [$EntryName; Value:MBS("LDAP.SearchResult.DistinguishedName"; $ldap; $EntryIndex)]
# loop over attributes
Set Variable [$AttributeCount; Value:MBS("LDAP.SearchResult.AttributeCount"; $ldap; $EntryIndex)]
If [$AttributeCount]
Set Variable [$AttributeIndex; Value:0]
Loop
# get detail for attribute
Set Variable [$AttributeCount; Value:MBS("LDAP.SearchResult.AttributeCount"; $ldap; $EntryIndex)]
Set Variable [$EntryName; Value:MBS("LDAP.SearchResult.DistinguishedName"; $ldap; $EntryIndex)]
Set Variable [$AttributeName; Value:MBS("LDAP.SearchResult.AttributeName"; $ldap; $EntryIndex; $AttributeIndex)]
Set Variable [$AttributeValues; Value:MBS("LDAP.SearchResult.AttributeValues"; $ldap; $EntryIndex; $AttributeIndex; 1)]
# store in a record
New Record/Request
Set Field [LDAP Query::Entry; $EntryName]
Set Field [LDAP Query::Attribute; $AttributeName]
Set Field [LDAP Query::Values; $AttributeValues]
Commit Records/Requests [No dialog]
# next
Set Variable [$AttributeIndex; Value:$AttributeIndex + 1]
Exit Loop If [$AttributeIndex = $AttributeCount]
End Loop
End If
Set Variable [$EntryIndex; Value:$EntryIndex + 1]
Exit Loop If [$EntryIndex = $EntryCount]
End Loop
End If
See also
- LDAP.AddJSON
- LDAP.Connect
- LDAP.JSON
- LDAP.ModifyJSON
- LDAP.Search
- LDAP.SearchResult.AttributeCount
- LDAP.SearchResult.AttributeName
- LDAP.SearchResult.AttributeValue
- LDAP.SearchResult.AttributeValues
- LDAP.SearchResult.DistinguishedName
Example Databases
Blog Entries
This function is free to use.
Created 15th December 2015, last changed 16th December 2015
LDAP.SearchResult.AttributeValuesByName - LDAP.SearchResult.DistinguishedName
