Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5    Statistic  

LDAP.SearchResult.Count

Queries number of entries in search results.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
LDAP 6.0 Yes Yes Yes Yes No

MBS( "LDAP.SearchResult.Count"; LDAPRef )

Parameters

Parameter Description Example value
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

Example Databases


LDAP.SearchResult.AttributeValuesByName   -   LDAP.SearchResult.DistinguishedName

Feedback: Report problem or ask question.




Links
MBS Xojo PDF Plugins