Skip to main content
Nintex Community Menu Bar
Solved

SQL Procedure

  • June 28, 2022
  • 4 replies
  • 27 views

Hello People,

 

I need help with an sql procedure. I am trying to make the procedure accept multiple entries in a list view, which it will in turn post. The script I have can only cater for a single entry per parameter in an item view, and list view.

Any help as regards this will be appreciated.

 

Find attached the sample script.

The Guarantor, and DirectorsInfo are the places where I want the script to accept multiple values in a list view.

Best answer by kimh

Without knowing too much about how the data is to be consumed, is it possible to use a STRING_AGG to list the comments in a string such as: 

@DirectorsInfo nvarchar(100) = (Select STRING_AGG([Comments], ',') from [K2].[SmartBoxData].[FOS_Corp_BoardofDirectorsOwnershipStructure_SMO] where HeaderID = @HeaderId),

 

That should return the JSON value as "DirectorsInfo":"Comment 1,Comment 2,Comment 3" in the output.  There are potentially several ways to solve this depending on how you need the data to display in your output. 

4 replies

  • Nintex Employee
  • Answer
  • June 28, 2022

Without knowing too much about how the data is to be consumed, is it possible to use a STRING_AGG to list the comments in a string such as: 

@DirectorsInfo nvarchar(100) = (Select STRING_AGG([Comments], ',') from [K2].[SmartBoxData].[FOS_Corp_BoardofDirectorsOwnershipStructure_SMO] where HeaderID = @HeaderId),

 

That should return the JSON value as "DirectorsInfo":"Comment 1,Comment 2,Comment 3" in the output.  There are potentially several ways to solve this depending on how you need the data to display in your output. 


  • Author
  • June 29, 2022
@kimh thanks for your reply.
DirectorsInfo":"BVN-12345678901-xyz@abcd.com|BVN-12345678901-xyz@werty.com",
"Guarantor":"NON-INDIVIDUAL_TIN_12133453_100000000|INDIVIDUAL_BVN_12133453_200000000"
}

Considering that the above are the sample payload for the 2 parameters.
Nevertheless, I will try the string_agg method when I am at my desk.


Forum|alt.badge.img+9
  • Rookie
  • June 30, 2022

Be careful here - I'm fairly confident that you are not allowed to add your own stored procedures to the K2 database, or to call into the K2 database directly as this will leave you in an unsupported state.

 

Cheers


  • Author
  • July 2, 2022

Thanks to everyone I found my way around the script, and I am good now.