Skip to main content
Nintex Community Menu Bar
Solved

SQL Procedure

  • Jun 28, 2022 9:55 AM UTC
  • 4 replies
  • 69 views
  • Translate All

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. 

View original

4 replies

  • Nintex Employee
  • Answer
  • Jun 28, 2022 9:51 PM UTC

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. 

Translate

  • Author
  • Nintex Partner
  • Jun 29, 2022 7:22 AM UTC
@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.

Translate

Forum|alt.badge.img+9
  • Nintex Partner
  • Jun 30, 2022 10:03 AM UTC

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

Translate

  • Author
  • Nintex Partner
  • Jul 2, 2022 4:35 AM UTC

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

Translate