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

De Wiki1000
(Page créée avec « <source lang='delphi'>function Execute(var aReason:string):boolean</source> Cette méthode exécute l'export. {|class="wikitable" |- |aReason |Raison de l'échec |- |Ret... »)
 
Aucun résumé des modifications
Ligne 13 : Ligne 13 :


Exemple :
Exemple :
'''Export dans un fichier:'''


<source lang="delphi">
<source lang="delphi">
//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;
</source>
</source>
'''Export dans un containeur:'''
<source lang="delphi">
//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.OutputContainerName := 'TestSyfre';
  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;
</source>
'''Export dans une boîte à message:'''
<source lang="delphi">
//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);
  // @glbUserName will be translated to current user name
  //
  qbe.OutputMailTo := '@glbUserName';
  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;
</source>


Voir aussi:
Voir aussi:

Version du 14 janvier 2020 à 16:10

<source lang='delphi'>function Execute(var aReason:string):boolean</source>

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:

<source lang="delphi"> //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('cant execute');
 if qbe.Execute(aReason) 
  then showMessage('execute OK')
  else showMessage('execute NOK '+aReason) 

end; </source>

Export dans un containeur:

<source lang="delphi"> //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.OutputContainerName := 'TestSyfre'; 
 qbe.OutputDocumentName := 'wfclassea'; 
 if not qbe.canExecute then
  raise Exception.Create('cant execute');
 if qbe.Execute(aReason) 
  then showMessage('execute OK')
  else showMessage('execute NOK '+aReason) 

end; </source>

Export dans une boîte à message:

<source lang="delphi"> //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);
 // @glbUserName will be translated to current user name
 //
 qbe.OutputMailTo := '@glbUserName';
 if not qbe.canExecute then
  raise Exception.Create('cant execute');
 if qbe.Execute(aReason) 
  then showMessage('execute OK')
  else showMessage('execute NOK '+aReason) 

end; </source>


Voir aussi:

{{#if:TQueryExecuteTask_(class)|

{{#if:TQueryExecuteTask_(class)|— TQueryExecuteTask_(class) |}} — Développement DSM

|

{{#if:|— [[{{{1}}}]] |}} — Développement DSM

}}