cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Nintex_Man
Nintex Newbie

How to use a Development and Production Database with a SQL Request control

Jump to solution

We have a development SharePoint 2016 onprem environment that points to a development SQL Server database server. When we move our code to Production we do not want to have to modify the Nintex forms to change the name of the database server. Is there a way to have a database alias so that we can have dynamic coding based upon the SharePoint environment?

Labels: (1)
0 Kudos
Reply
5 Replies
Nintex Employee
Nintex Employee

Re: How to use a Development and Production Database with a SQL Request control

Jump to solution
Add the following formula (modified to suit your environment) to the server name field in the SQL request control.
fn-If(fn-contains(Site URL,"ProdSite Name"),"ProdServer","DevSever")
Tested and it works.

0 Kudos
Reply
Nintex_Man
Nintex Newbie

Re: How to use a Development and Production Database with a SQL Request control

Jump to solution
thanks, I just did a quick test and it did not work. is the syntax correct below? Also assuming the function is an if/else ?

fn-If(fn-contains(Site URL,"http://www.google.com"),"proddb\db1","devdb\db1")
Reply
Nintex Employee
Nintex Employee

Re: How to use a Development and Production Database with a SQL Request control

Jump to solution

Looks correct.
What happens if you cut it down a bit.
fn-If(fn-contains(Site URL,"google"),"proddb\db1","devdb\db1")
Test in a calaculated value control to make sure the formula is working.

View solution in original post

Reply
Nintex_Man
Nintex Newbie

Re: How to use a Development and Production Database with a SQL Request control

Jump to solution
Silly me, I was trying to test this via "Test Connection". After publishing the form and trying it, it looks like this works!

More tests tomorrow with my team.

I'll update the post to confirm, thank you @SimonMuntz !
0 Kudos
Reply
Nintex_Man
Nintex Newbie

Re: How to use a Development and Production Database with a SQL Request control

Jump to solution
@SimonMuntz we have fully tested this and it does work.

However after further discussions with the team we were able to find a better approach. We are using a Nintex constant that contains the database name. We will use the name of the Nintex constant in the SQL Request control. This gives us more options in case we ever need to change the SQL Server to another instance and allows us to make the change in one location that will reflect all forms.

Thank you for your help!
Reply