asked on April 16, 2018
Hi all,
Actually, I'm using Workflow and Script SDK to export rapport to Windows (csv).
I'm using 2 scripts :
1 for the header
namespace WorkflowActivity.Scripting.CSVEntête
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using Laserfiche.RepositoryAccess;
public class Script1 : RAScriptClass102
{
protected override void Execute()
{
// fpath = Dossier de destination (ci-dessous fpath = C:\ProgramData\CSV\)
//string fpath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),@"CSV\\");
string fpath = "C:\\Export CSV";
//Si le dossier de destination n'existe pas, on le créer
if(!System.IO.Directory.Exists(fpath))
System.IO.Directory.CreateDirectory(fpath);
//On enregistre le fichier file.csv dans fpath
fpath = System.IO.Path.Combine(fpath, "CCISM - Rapport du " + GetTokenValue("Today") + ".csv");
// create a token or update one if you added an Assign Tokens activity
SetTokenValue("csvpath", fpath);
// On génère les différentes valeurs des titres des champs ";"
string s = "\"ID\";";
s += "\"Nom\";";
s += "\"Destiné à\";";
s += "\"Type de formulaire\";";
s += "\"Numéro de liasse\";";
s += "\"Titre de la liasse\";";
s += "\"Déclaration N°\"";
// On rentre ici les noms des différents champs et on termine par "Environment.NewLine" pour un retour à la ligne
System.IO.File.WriteAllText(fpath, s + Environment.NewLine);
}
}
}
And the other for values (using the tool search and loop)
namespace WorkflowActivity.Scripting.CSVEnregistrements
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using Laserfiche.RepositoryAccess;
public class Script1 : RAScriptClass102
{
protected override void Execute()
{
// On génère les différentes valeurs séparé par un ";"
string s = "\"" + FixValue(GetTokenValue("ID_doc")) + "\"";
s += ";\"" + FixValue(GetTokenValue("Nom")) + "\"";
s += ";\"" + FixValue(GetTokenValue("Champs_Destiné à")) + "\"";
s += ";\"" + FixValue(GetTokenValue("Champs_Type de formulaire")) + "\"";
s += ";\"" + FixValue(GetTokenValue("Champs_Numéro de Liasse")) + "\"";
s += ";\"" + FixValue(GetTokenValue("Champs_Titre de la Liasse")) + "\"";
s += ";\"" + FixValue(GetTokenValue("Champs_Déclaration N°")) + "\"";
// On termine la boucle par un retour à la ligne
System.IO.File.AppendAllText(GetTokenValue("csvpath").ToString(), s + Environment.NewLine);
}
private string FixValue(object o)
{
if(o == null)
return "";
else
return o.ToString().Replace("\"", "\"\""); // make sure properly escaped
}
}
}
My question is :
Instead of defining the headers and values, is it possible to reuse the Laserfiche Columns' configuration?
This is what i means.
Using Laserfiche, I created/saved the columns LIASSES
And still using Laserfiche, I can export my rapport.
Now I wish my workflow can do that. I means I don't want to configure headers and values in my script SDK, I want to use them from my column's saved.
Is it possible and if yes, how can I do ?
Thanks in advance.
Regards
0
0