MemberExists (open)

Check if a specific member exists in a object

Syntax

// Core function, no LOADLIB necessary

BOOLEAN FUNCTION MemberExists(OBJECT obj, STRING membername)

Parameters

OBJECT obj

Object to read

STRING membername

Name of the member to look for

Return value

BOOLEAN

True if a member with name @italic membername exists in record @italic obj, false if it does not exist or if the object does not exist.

Description

This function checks if the object contains a member with the specified name. Member names are case-insensitive. If a hatted property is requested, eg ^mymember, MemberExists may return FALSE if the property hasn't been initialized yet, even if GetMember would return the property.

Examples

// Ensure that the member 'mymember' exists in the object
OBJECT obj := DEFAULT OBJECT;
IF (NOT MemberExists(obj,"mymember"))
  Print ("This object does not contain a member named 'mymember'");