Last active
April 28, 2021 08:38
-
-
Save enkelmedia/5d6ee184cc3d404b524b51730537a9ff to your computer and use it in GitHub Desktop.
Multi Node Tree Picker-convert function.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[mntpConvert] | |
( | |
-- Add the parameters for the function here | |
@mntpXml ntext | |
) | |
RETURNS nvarchar(MAX) | |
AS | |
BEGIN | |
-- Declare the return variable here | |
DECLARE @Result nvarchar(MAX) | |
DECLARE @list nvarchar(MAX) | |
DECLARE @xml XML | |
DECLARE @mntpData nvarchar(MAX) | |
SELECT @mntpData = CONVERT(nvarchar(500),@mntpXml) | |
SELECT @xml = CONVERT(xml, @mntpData) | |
SELECT @list = ISNULL( @list + ',', '' ) + x.y.value('.', 'VARCHAR(500)' ) | |
FROM @xml.nodes('MultiNodePicker/nodeId') x(y) | |
-- Add the T-SQL statements to compute the return value here | |
SELECT @Result = CONVERT(nvarchar(MAX),@list) | |
-- Return the result of the function | |
RETURN @Result | |
END | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Converts multi node tree picker from Umbraco 6 (xml) to Umbraco 7 (ids), note that this is the "legacy" format for MNTP in Umbraco 7 and will note work if you indent to upgrade further to Umbraco 8.