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

Question

Question

Updating sql data with an activity

asked on February 14, 2017

Is there a recommended workflow activity that I could use to UPDATE SQL data coming from an LF Form?

 

Currently I'm using the "Insert Data" activity to INSERT data from a form, but we have a situation in which we are retrieving information from the database using a form, and will like to send it back with updated information.

 

I'm using a custom GUID to identify each form so that shouldn't be a problem, it's just that I can't find a way to make an UPDATE, as opposed to just INSERT.

0 0

Answer

SELECTED ANSWER
replied on February 14, 2017

There is an 'Update Data Activity' that you should be able to use

0 0
replied on February 15, 2017

Thanks Andrew, that worked like a charm.

 

Hey, here is a related question; I have an LF Table, that allows us to add rows dynamically of course. We are using Lookup Rules to populate the values back to the table from our database for updating. As of now, if I want to update a form that had, say, 2 records added dynamically, belonging to the same form, I can individually update each of those rows with different values using the Update Data activity. 

 

However, if I want to add a new row, the two existing rows are updated as expected, but the new non'-existing row isn't added.

 

I guess the short instruction is: Find this row, and update it with this value where the Unique ID is this (which works).

 

But since the newly added row doesn't exist, it's not inserted. Is there anyway to do this within the same Update Data activity or do I have to play around with other activities to check if the row exists first, and if it doesn't do go via the "Insert Data" activity route?

 

I'm attaching a file to see if I can make more sense of what I'm saying :)

 

Thanks again Andrew

UpdateInsert.png
0 0
replied on February 15, 2017

You are on the right track!    You will need to use the insert activity to add a new row.   Update will only work on existing rows.    Just use a conditional decision to determine if it is an existing row or not and branch to either an update or insert activity.

It can also be helpful to wrap your updates or inserts in a 'Try-Catch' activity just in case the database update/insert does not work for some reason.  You can then deal with the error or end the workflow with an email about the problem.

0 0
replied on February 15, 2017

Andrew, thanks for pointing me to the right direction. I gotta tell you, I was trying something similar (I thought), but wasn't able to make it work. I had to come back to your post and re-read it; and finally was able to come up with a solution.

 

I'm attaching a screenshot of a simplified version just to share what I have so far.

 

Pending will be the ability to delete records from the form and update (remove the rows) from the database table.

 

Thanks again, this is working for now.

 

s2_15_17.png
s2_15_17.png (6.43 KB)
0 0
replied on February 16, 2017

Andrew, I'm working with our Workflow administration on the issue of me not seeing the "Update Data" activity, among other activities. He's trying to figure out why this is happening, but I mentioned that you had assisted me in pointing me to the right direction on how to use these activities, and I told them that I would ask if you've ever seen this issue before and possibly share a fix.

 

Thanks Andrew.

0 0
replied on February 16, 2017

Hi Raul,
I don't know why you wouldn't be able to see all the workflow activities.  As far as I know they can't be limited, if you have permission to create workflows you see everything.   You might try using the search in the toolbox to see if they are hiding somewhere!
If the problem persists I would recommended opening another question on the Answers page so that it is seen by everyone or contacting your VAR.

Sorry I can't be of help on this one, curious to what the issue is though.
Andrew

 

1 0
replied on February 21, 2017

Andrew, I just found out that the Workflow behavior indicated above is part of a custom request, having to do with registry settings. In a clean install this Activities indicated would actually show.

 

Thanks,

Raul

1 0

Replies

replied on February 14, 2017

MMM. I probably lack privileges in those activities then. I can't see any of that. I'll ask my supervisor. 

 

It seems that once I'm able to work with those activities I should be able to move forward. Thanks Andrew.

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

Sign in to reply to this post.