GetWhere (TSDataRemoteObject)
class function GetWhere(const iWhere,iOrderBy:string; Args:Array of variant):TSDataRemoteObject;
Cette fonction retrouve une ressource SData par une recherche.
| Tip : Cette méthode utilise un fournisseur de service enregistré dans l'Administration |
| iWhere | La clause Where de recherche. |
| iOrderBy | La clause de tri de recherche. |
| iArgs | Les arguments de la clause Where. |
Exemple :
var inst:RE_Expense; aReason:string;
begin
aReason := Format('expense du %s',[FormatDatetime('c',Now)]);
inst := RE_Expense.Create;
inst.reason := aReason;
inst.dateExpense := Now;
inst.quantity := 1;
inst.status.AsVariant := RE_NDF_STATUS_DRAFT;
inst.Post;
showMessage(Format('oid:%s id:%s key:%s etag:%s',[inst.OID,inst.SDataID,inst.SDataKey,inst.SDataEtag]));
inst := RE_Expense.GetWhere('reason=%1','dateExpense',[aReason]) as RE_expense;
if Assigned(inst) then
begin
if inst.reason = aReason
then showMessage('create ok')
else showMessage('create failed')
end
else showMessage('not found after create');
end;
Voir aussi
— Classe entité de service distant (stereotype) — Développement DSM —