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

Question

Question

Field Pick List

asked on April 23, 2014

Can you import a list from a csv or db to fill a field pick list?

 

0 0

Replies

replied on April 30, 2014

Workflow can be used to do this, but it's a bit complicated to edit a list field directly. You can add items to a list field using the 'Append List Field Choices' activity, but you can't remove items without a script. More information about this can be found in this Laserfiche Answers thread. The easiest way to have dynamic content for list fields is to set up a dynamic field that references a SQL table. This SQL table can be updated by Workflow, or you can have the DBMS load the contents of the CSV file automatically on a schedule.

 

Workflow can update the SQL table by querying the CSV file for all new rows and then making the changes to the database as needed. This workflow would run on a schedule (daily, for instance). Workflow can get the information from the CSV file by treating it like a database and performing a lookup on it. This is done by creating a datasource, using the 'Direct Connection' configuration option, using the 'Data Source Type' ODBC with a CSV driver, and pointing it at the folder that contains the CSV file. Each CSV file will show up as a table, and you'll be able to query it for the rows. From there, you'll need to build in logic to figure out which rows were added, which were removed, and which were updated. It shouldn't be too bad though.

 

To have MSSQL (or another DBMS) update itself automatically, you can write a short SQL script to import the CSV file into your table. The command at the heart of your script (for MSSQL) will be BULK INSERT. This article has a sample script and the commands for other DBMSs. Keep in mind that you'll have to build in logic to deal with duplicate rows and row removal just like the workflow example. This script would run on a schedule as well.

 

In the end, you'll probably want to go with the method you're most familiar with--both will work fine.

1 0
replied on April 24, 2014

Hi Casey,

 

Are you referring to a list-type metadata field, or a dropdown field in Forms? Are you looking to do a one-time import, or to pull from a database so that the field contents update as the database updates? 

 

In either case this should be doable, but the specifics would change. Let us know what you're trying to accomplish and we can find a solution for you!

0 0
replied on April 24, 2014

Yes a list-type in a metadata field. They export addresses from access to a csv to a certain location. the file then just gets overwritten at that location. Can we pull this info from the csv for the list in the metadata field?

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

Sign in to reply to this post.