「レコードの検索」の機能を提供します。指定されたレコード データベース ID (DBID) の EntitiyDef オブジェクトを戻します。このメソッドでは、その DBID を検索するときの EntityDef タイプと EntityDef 名 (オプション) を指定する必要があります。
entDefNames の配列では、複数のレコード タイプでの検索が可能なので、どのレコード タイプが一致したかを見極めるために、戻された EntityDef タイプを確認する必要があります。また、entityDeftype 引数として ANY_ENTITY を使用する場合は、戻されたレコードが、状態あり (REQ_ENTITY) レコードか、状態なし (AUX_ENTITY) レコードかを判別する必要があります。
指定の表示名あるいは DBID を持つエンティティがデータベースに存在している場合は、GetEntityDefOfName と GetEntityDefOfDbId のどちらを呼び出してもかまいません。一度、EntityDef がわかれば、Session オブジェクトの GetEntity メソッドを呼び出して、エンティティを取得することができます。
データベース ID の代わりに表示名を使用してレコード タイプを要求するには、GetEntityDefOfName メソッドを使用します。
VBScript
session.GetEntityDefOfDbId(db_id, entitydef_names,entitydef_type)
Perl
$session->GetEntityDefOfDbId(db_identitydef_names, entitydef_type);
レコードの一意な ID (Entity)。
Visual Basic の場合、文字列の配列を含む Variant。 各文字列には、EntityDef 名が含まれます。
Perl の場合は、文字列の配列への参照。各文字列には、EntityDef 名が含まれます。
EntityDef の名前を使用して、表示名または DbId で識別されるエンティティが検索されます。 EntityDef 名のリストが、指定の順序で繰り返し処理されます。entDefNames 引数に指定された EntityDef 名に無効なものがあると、無効な名前があることを確認したという例外がスローされます。配列値が空で指定された場合、スキーマに定義されているすべての EntityDef タイプが使用されます。そのときの検索順序は、最もよく検出される EntityDef から始めて、最も検出されない EntityDef が最後になります。
Perl
use CQPerlExt;
# Build session...
# Log in...'Session UserLogon method'
# Determine the array of Entity Def Names for searching...
eval { $entDefNamesDB = $CQSession->GetEntityDefNames(); };
# Sort the list of entity def names returned from GetEntityDefNames()
@entDefNamesDBsorted = sort @$entDefNamesDB;
$entDefNamesDBsorted = ¥@entDefNamesDBsorted;
# EntityDef Names can be supplied by the user. For example:
# @entDefNamesUser = ($ARG{'EDEF1'},$ARG{'EDEF2'},$ARG{'EDEF3'});
# $entDefNamesUser = ¥@entDefNamesUser;
# if using user supplied EntityDef Names for searching then
# $entDefNames = $entDefNamesUser;
# else use all DB EntityDef names for searching:
$entDefNames = $entDefNamesDBsorted;
# Call CQSession->GetEntityDefOfDbId()...
my($DbId) = $ARG{'DBID'};
eval { $CQEntityDefOfDbId = $CQSession->GetEntityDefOfDbId($DbId, $entDefNames, $ARG{'ENTTYPE'}); };
# exception handling goes here...
# Get the Entity Def Name of the record...
eval { $CQEntityDefName = $CQEntityDefOfDbId->GetName(); };
# exception handling goes here...
# Get entity...