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

Question

Question

How to use Lookup Rules to send data from Form to SQL Table

asked on September 17, 2019 Show version history

Could someone help me set up my Lookup Rules in my Form?  I have successfully done this where the Form looks to the SQL and populates my form, but in this case, I'm wanting a collection field table to populate the SQL datasource so that the information can then be used later in the process to calculate costs, like in an invoice:  10 of Item A ordered, 15 of Item B ordered. 

At Stage One (application) we don't know the costs; at Stage Three (order is being placed) we have the costs and want the table populated with values, and need to report costs to the applicants.

I have also successfully built the cost calculations directly into the form table at Stage Three, however, it would be an incredible amount of work savings for the process users if they can just have IT plug in the costs for each item directly into the SQL table and let the forms take care of each order via the lookup table.  SO, IN EFFECT, at Stage 1, I need it to send data to the SQL; and at Stage 3, I need it to lookup the SQL table and bring back the values to continue populating the table with the costs.

The following LF Answers post makes me think possibly sending data to the SQL is only done via workflow?

https://answers.laserfiche.com/questions/93150/How-to-insert-data-into-SQL-Server-from-a-table-with-repeatable-rows#143928

0 0

Answer

SELECTED ANSWER
replied on October 1, 2019

I think what I was missing was "Started by Laserfiche Forms"!  Plus, I went back to the Insert Data.  It is now actually inserting data into the SQL datasource upon submission of a Laserfiche form!!

 

 

1 0

Replies

replied on September 17, 2019

This has to be done via Laserfiche Workflow. It's relatively easy though as you can send the process variables to Workflow, and then send any back to the process if needed.

0 0
replied on September 17, 2019

Thanks, Michael!  

Do you have an example of how to set that up in Workflow?

0 0
replied on September 17, 2019

You're welcome, Connie,

 

Yes, you use the Retrieve Business Process Variables tool and then use a stored procedure within a Custom Query tool. We use this in several processes and their associated workflows.

0 0
replied on September 17, 2019

Okay, I have this so far.  I have the RBPV activity set to bring in the data on the collection field's table rows, but can't seem to get the custom query to see where to connect with that data.

I have made it (1) a business process, (2) started by LF Forms.

0 0
replied on September 17, 2019

What do you have listed under the Data Source dropdown? It looks like it's your custom query activity. What I do is configure a data source within the Workflow Admin Console. 

 

 

You should also be able to configure it within the Data Source drop down by clicking on the Manage Data Sources option. 

 

Please see this reference for additional information regarding configuring those. https://www.laserfiche.com/support/webhelp/Laserfiche/10/en-US/administration/Default.htm#../Subsystems/LFWorkflow/Content/Resources/Configuration/External%20Objects/Data%20Source%20Administrator.htm?Highlight=data%20source

 

 

1 0
replied on September 17, 2019

Getting closer, but how do I get it set up so the

  • applicant name is sent to the SQL,
  • the BP Instance # goes in as the SQL "Order Number" and then
  • the Rows populated with the quantity and Item numbers kept together,
  • with some additional options recorded on the spreadsheet, as well? 

0 0
replied on September 17, 2019

I think I've got the data source figured out; it accepted my choices.  

0 0
replied on September 17, 2019

You'll also need to configure a stored procedure (to call from Workflow) on the SQL side of your database.

1 0
replied on September 17, 2019 Show version history

Getting closer! I can add the Instance ID as the Order ID here, the applicant's names, etc...

(I'm sorry, I'm very visual, so I need to see it; and like to offer my views to help anyone else trying the same thing.)

0 0
replied on September 18, 2019

are you getting an error?

0 0
replied on September 19, 2019

Frank, I can't even publish my workflow because I can't find how to tell it which form or which table the data is to be pulled from, yet I am able to tell it what "retrieved fields" data to send to the SQL tables.

0 0
replied on September 19, 2019

You choose the form to pull from via the properties panel on the right. First choose your Forms server, and then the process you want to pull the data from. If you're able to tell it what "retrieved fields" data to send to the SQL tables, then it sounds like you already have the referenced section completed.

 

0 0
replied on September 19, 2019

Hi Michael!  Yes, I would have thought so also!  The RBPV was configured fine and I was able to pick the fields that are on the form.  Yet, the Custom Query could not be configured to find the table.  It could find the RBPVariables (the fields I'm pulling off the table).

I don't know how to build the Query, that's part of it, but also the For Each Row variable could not match up to anything.  Now that I'm looking at it again today, I'm wondering if the For Each Row just needs the "Get Rows From" the Custom Query, however, that doesn't make sense to me as I know it needs to get the rows from the table in the form.

0 0
replied on September 19, 2019

So, when you say table, are you referring to the SQL table, or are the values on the form you're pulling from in an actual table on the form?

0 0
replied on September 19, 2019

Well, there's the table in the form, from which I want to send to the SQL tables/database/column fields.

0 0
replied on September 19, 2019

The table on the form is in a collection, so there might be two rows on one order submission and ten rows on another order submission.

0 0
replied on September 19, 2019

You'd definitely need to use the "for each row" for that, so you're on the right track. I notice above that you're using the "Update Data" tool. I think you need to be using the Custom Query tool in conjunction with a stored procedure in order to update your SQL tables. 

0 0
replied on September 19, 2019

Yes, I've tried both the Custom Query and the Update Data tools.  Another post with a similar situation suggested the he Custom Query was the one to use.  Still, I cannot publish my workflow.  I need to see an example of someone who has done this and be able to pick apart his/her configurations until I can piece mine together in the same way.  I can't find an example similar enough and detailed enough.

0 0
replied on September 19, 2019

Did you click on the Custom Query link in my last post? It takes you to the admin guide for that tool. It's what I used to configure ours. You'll need your stored procedure in place to call it from your workflow. You'll also need to configure the data source as I'd mentioned yesterday. There's a link for that section as well. Once you've built your stored procedure in your SQL table, and configured the data source, you should then be able to enter the necessary information in the Custom Query Editor and publish your workflow. Here's an example of what that looks like from one of ours. (Note: I've blurred our SP and variable names.)

 

0 0
replied on September 19, 2019

Thanks, Michael.  Yes, I did.  That takes me to help for setting up the connection to the SQL, which I had already figured out.  Not sure what you're referring to with "stored procedure" but my Custom Query looks just like yours, with the exception of having nothing in the big white box at the top (the editor?).  And configuring the data source is also something that I have done.  It appears to be correct, as it is actually letting me make the connections with the column headers that are found in the SQL table, so I know it is correct.

0 0
replied on September 19, 2019

stored procedure is a set of Structured Query Language (SQL) statements with an assigned name, which are stored in a relational database management system as a group, so it can be reused and shared by multiple programs. If you don't know how to write one, then you'll need to find someone within your organization's IT department to write one for you. Either that or learn. I had users on my end write ours as I'm rather deficient in that respect. The part blurred out in the big white box is the name of our stored procedure. 

0 0
SELECTED ANSWER
replied on October 1, 2019

I think what I was missing was "Started by Laserfiche Forms"!  Plus, I went back to the Insert Data.  It is now actually inserting data into the SQL datasource upon submission of a Laserfiche form!!

 

 

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

Sign in to reply to this post.