Hi,
Has anyone built a custom HTML, CSS and JavaScript necessary for downloading content of a table as a CSV file?
Hi,
Has anyone built a custom HTML, CSS and JavaScript necessary for downloading content of a table as a CSV file?
Hi Adarsh,
You can do this through LF workflow. Get Forms to trigger a workflow and you can write a script to output your csv file as you need it. Let me know if you require a sample workflow and I'll see what I can dig up.
edit: I have attached a sample workflow. This is creating an XML file but csv would be same process/ principle. Forms starts this workflow and the "for each row" activity loops through the rows within the targeted Forms table and exports the information using the scripts.
Regards,
Aaron.
Hi Aaron, thanks for your answer. I have used scripts in the past and have recently developed a SQL query to generate a csv file.
I was just keen to find out if there was an elegant way.
Hi Aaron
Could you give me the script you used to do this please?
I am trying to export a sql table in to csv format using Workflow but I cannot get the script to work.
Thanks.
Hi There.
I have found an excellent way of doing this.
The C# code that runs in to create column headers:
namespace WorkflowActivity.Scripting.OnceOffSDRunExportCreateHeaders { using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Text; using System.IO; /// <summary> /// Provides one or more methods that can be run when the workflow scripting activity is performed. /// </summary> public class Script1 : ScriptClass90 { /// <summary> /// This method is run when the activity is performed. /// </summary> protected override void Execute() { string text = "value"+","+"value"+","+"\r\n"; File.AppendAllText("C:\\Your\\path\\here.csv", text); } } }
The C# code to append the values to the headers:
namespace WorkflowActivity.Scripting.OnceOffSDRunExportAppendValues { using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Text; using System.IO; /// <summary> /// Provides one or more methods that can be run when the workflow scripting activity is performed. /// </summary> public class Script1 : ScriptClass90 { /// <summary> /// This method is run when the activity is performed. /// </summary> protected override void Execute() { var Comments7 = (string) (GetTokenValue("Comments7")); var Comments8 = (string) (GetTokenValue("Comments8")); string text = Comments7+","+Comments8+"\r\n"; File.AppendAllText("C:\\your\\path\\here.csv", text); } } }
Cheers :D
Hello
Is it possible to do this task but that the file is created inside Laserfiche so that in the same Workflow or in another it is sent by mail?
Hi Ricardo.
Just set up ImportAgent to the folder you specified in the script.
Once imported, let a Workflow email it to the desired individual.
I'm sure using Workflows SDK you can very easily email the CSV directly after creation to the desired mail. I don't know how that stuff works yet though.
Hope it helps.
Hi
Thanks for the help!
RE:
I've went ahead and created a small project on GitHub.
Check out the link to the Answers post which will take you there:
https://answers.laserfiche.com/questions/104034/Extracting-data-from-txt-file-vs-csv-file#164387
Good luck!