ExistsObjectsWhere (exp)
<source lang='delphi'>function ExistsObjectsWhere(iClassName:string; iExpression:string):Integer;</source>
Retourne 1 si il existe au moins un objet de iClassName vérifiant iExpression; retourne 0 sinon.
Exemples :
Utilisation de ExistsObjectWhere pour charger des objets dans une liste <source lang='delphi'> var aList:TConstitutionSectionGCList; begin
aList := TConstitutionSectionGC.CreateList; aList.AddWhere('ExistsObjectsWhere(TIdentificationCentreGC,(oidConstitutionSectionGC=self.oid) and (identificationCentreNF<>%1))',,,True,-1,[]); for idx := 0 to aList.count-1 do begin end;
end; </source>
Dans cet exemple la liste est chargée des objets de TConstitutionSectionGC pour lesquels il existe au moins une TidentificationCentreGC dont l'identificationCentreNF est non vide.
Notez :
- Le doublage des quotes nécessaires pour les arguments de ExistObjectsWhere
- L'utilisation de self pour faire référence au contexte de TConstitutionSectionGC dans la requête sur les TIdentificationCentreGC.
Utilisation de ExistsObjectWhere pour rechercher un objet <source lang='delphi'> //procedure RegleAlerte_EtatMetierList:boolean; var obj:TEtatPossible; begin
//... obj := ClassManager.FindObject( 'TEtatPossible', '(oidCircuitValidation = %1) and (ExistsObjectsWhere(TEtatEngagement,(oid = self.oidEtatMetier) and (autorisePropositionAchat = True)))', 'ordre',True, [instanceOID]);
end; </source>
Dans cet exemple un objet de TEtatPossible ayant comme circuit de validation l'objet courant et pour lequel il existe au moins un TEtatEngagement pour lequel autorisePropositionAchat est vrai.
Voir aussi:
{{#if:Expressions objets (code)|
{{#if:Expressions objets (code)|— Expressions objets (code) |}} — Développement DSM —
|
{{#if:|— [[{{{1}}}]] |}} — Développement DSM —
}}