You are viewing limited content. For full access, please sign in.

Question

Question

Download form table content as csv

asked on September 25, 2017

Hi,

Has anyone built a custom HTML, CSS and JavaScript necessary for downloading content of a table as a CSV file?

0 0

Replies

replied on September 26, 2017 Show version history

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.

workflow table export.PNG
1 0
replied on September 26, 2017

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.

0 0
replied on June 29, 2018

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.

0 0
replied on November 8, 2018

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

1 0
replied on December 28, 2018

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?

0 0
replied on December 31, 2018

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.

1 0
replied on January 2, 2019

Hi

Thanks for the help!

 

 

0 0
replied on September 17, 2019

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!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.