FindObject (role)

De Wiki1000

version710-32x32.png

function FindObject(const iExpression:string; const iOrderBy:string; iArgs:Array of variant):Integer;

Cette fonction retourne le premier objet du rôle vérifiant l'expression suivant l'ordre de tri

Result Index du premier objet retrouvé
iExpression Expression logique
iOrderBy Ordre de tri
iArgs Argument de l'expression
Info-20px.png Note : Cette fonction provoque le chargement du rôle si celui-ci n'est pas chargé.

Exemple

//Procedure TestRoleFind;
var instX:WFClasseX; instXX:WFClasseXX; ls:WFClasseXXList; ctn,indx:Integer;
begin
  // WFClasseX has a role list of WFClasseXX
  //
  instX := WFClasseX.Find('','',true,[]);
  if not Assigned(instx) then Exit;
 
  // FindObject on a role list, return the object with the lower amount in the 40..50 range
  instXX := instX.WFClasseXXList.FindObject('(montant.value>%1) and (montant.value<%2)','montant',[40.00,50.00]);
  if Assigned(instXX)
     then ShowMessage(Format('Min amount:%02f',[instXX.montant.value]))
     else ShowMessage('Role.FindObject not found');
 
  // FindObject on a role list, return the object with the higher amount in the 40..50 range
  instXX := instX.WFClasseXXList.FindObject('(montant.value>%1) and (montant.value<%2)','-montant',[40.00,50.00]);
  if Assigned(instXX)
     then ShowMessage(Format('Max amount:%02f',[instXX.montant.value]))
     else ShowMessage('Role.FindObject not found');
end;

Voir aussi

Rôles (tech)Développement DSM





Whos here now:   Members 0   Guests 1   Bots & Crawlers 0
 
Outils personnels