ExistsObjectsWhere (exp)
De Wiki1000
(Différences entre les versions)
(Page créée avec « <source lang='delphi'>function ExistsObjectsWhere(iClassName:string; iExpression:string):Integer;</source> Retourne 1 si il existe au moins un objet de iClassName vérifi... ») |
|||
| Ligne 3 : | Ligne 3 : | ||
Retourne 1 si il existe au moins un objet de iClassName vérifiant iExpression; retourne 0 sinon. | Retourne 1 si il existe au moins un objet de iClassName vérifiant iExpression; retourne 0 sinon. | ||
| − | + | Exemples : | |
| − | <source lang= | + | |
| + | '''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> | </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: | Voir aussi: | ||
Version du 24 décembre 2013 à 11:40
function ExistsObjectsWhere(iClassName:string; iExpression:string):Integer;
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
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;
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
//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;
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:
| Whos here now: Members 0 Guests 0 Bots & Crawlers 1 |