« Execute (TQueryExecuteTask ) » : différence entre les versions

De Wiki1000
Aucun résumé des modifications
Aucun résumé des modifications
 
Ligne 45 : Ligne 45 :
var qbe:TQueryExecuteTask; doc:TxmlDocument; AStr,AReason:string;
var qbe:TQueryExecuteTask; doc:TxmlDocument; AStr,AReason:string;
begin
begin
   qbe := TQueryExecuteTask.Create;
   ...
 
   qbe.OutputContainerName := 'MyContainerName';  
  doc := CreateDescriptor();
  AStr := doc.SaveToString;
 
  // This will recreate the document with the correct classes
  qbe.Descriptor.Document.LoadFromString(AStr);
 
   qbe.OutputContainerName := 'TestSyfre';  
   qbe.OutputDocumentName := 'wfclassea';  
   qbe.OutputDocumentName := 'wfclassea';  
 
   ...
   if not qbe.canExecute then
  raise Exception.Create('can''t execute');
 
  if qbe.Execute(aReason)
  then showMessage('execute OK')
  else showMessage('execute NOK '+aReason)
end;
end;
</source>
</source>
Ligne 71 : Ligne 58 :
var qbe:TQueryExecuteTask; doc:TxmlDocument; AStr,AReason:string;
var qbe:TQueryExecuteTask; doc:TxmlDocument; AStr,AReason:string;
begin
begin
   qbe := TQueryExecuteTask.Create;
   ...
 
  doc := CreateDescriptor();
  AStr := doc.SaveToString;
 
  // This will recreate the document with the correct classes
  qbe.Descriptor.Document.LoadFromString(AStr);


   // @glbUserName will be translated to current user name
   // @glbUserName will be translated to current user name
Ligne 83 : Ligne 64 :
   qbe.OutputMailTo := '@glbUserName';
   qbe.OutputMailTo := '@glbUserName';


   if not qbe.canExecute then
   ...
  raise Exception.Create('can''t execute');
end;
</source>
 
'''Export envoyé par email:'''


   if qbe.Execute(aReason)
<source lang="delphi">
  then showMessage('execute OK')
//Procedure Test;
  else showMessage('execute NOK '+aReason)
var qbe:TQueryExecuteTask; doc:TxmlDocument; AStr,AReason:string;
begin
  ...
 
  // Will be send by email using configured smtp service
  //
   qbe.OutputMailTo := '[email protected]';
  qbe.OutputMailBody := 'This is an export of ... from Sage FRP 1000';
 
  ...
end;
end;
</source>
</source>


Voir aussi:
Voir aussi:

Dernière version du 15 janvier 2020 à 07:16

function Execute(var aReason:string):boolean

Cette méthode exécute l'export.

aReason Raison de l'échec
Return True si l'export c'est exécuté

Exemple :

Export dans un fichier:

//Procedure Test;
var qbe:TQueryExecuteTask; doc:TxmlDocument; AStr,AReason:string;
begin
  qbe := TQueryExecuteTask.Create;

  doc := CreateDescriptor();
  AStr := doc.SaveToString;

  // This will recreate the document with the correct classes
  qbe.Descriptor.Document.LoadFromString(AStr);

  qbe.OutputFileName := 'c:\temp\exports\wfclassea.csv'; 

  if not qbe.canExecute then
   raise Exception.Create('can''t execute');

  if qbe.Execute(aReason) 
   then showMessage('execute OK')
   else showMessage('execute NOK '+aReason) 
end;

Export dans un containeur:

//Procedure Test;
var qbe:TQueryExecuteTask; doc:TxmlDocument; AStr,AReason:string;
begin
  ...
  qbe.OutputContainerName := 'MyContainerName'; 
  qbe.OutputDocumentName := 'wfclassea'; 
  ...
end;

Export dans une boîte à message:

//Procedure Test;
var qbe:TQueryExecuteTask; doc:TxmlDocument; AStr,AReason:string;
begin
  ...

  // @glbUserName will be translated to current user name
  //
  qbe.OutputMailTo := '@glbUserName';

  ...
end;

Export envoyé par email:

//Procedure Test;
var qbe:TQueryExecuteTask; doc:TxmlDocument; AStr,AReason:string;
begin
  ...

  // Will be send by email using configured smtp service
  //
  qbe.OutputMailTo := '[email protected]';
  qbe.OutputMailBody := 'This is an export of ... from Sage FRP 1000';

  ...
end;

Voir aussi:

TQueryExecuteTask_(class)Développement DSM