USP_DATAFORMTEMPLATE_VIEW_REVENUEAPPLICATIONSMARTFIELD

The load procedure used by the view dataform template "Revenue Application Smartfield View Form"

Parameters

Parameter Parameter Type Mode Description
@DATALOADED bit INOUT Output parameter indicating whether or not data was actually loaded.
@SELECTIONS xml INOUT Selections

Definition

Copy


                CREATE procedure dbo.USP_DATAFORMTEMPLATE_VIEW_REVENUEAPPLICATIONSMARTFIELD
                (
                    @DATALOADED bit = 0 output,
                    @SELECTIONS xml = null output
                )
                as
                set nocount on;

                declare @TRANSACTIONTYPECODES xml;
                exec dbo.USP_REVENUE_TRANSACTIONAPPLICATIONHIERARCHY @DATALOADED = @DATALOADED output, @TRANSACTIONTYPECODES = @TRANSACTIONTYPECODES output;

                --Shred the @TRANSACTIONTYPECODES variable and then recreate it. Need to change the xml root name to 'SELECTIONS' to match the form

                declare @TRANSACTIONTYPES table
                    (
                    ID uniqueidentifier,
                    PARENTID uniqueidentifier,
                    APPLICATION tinyint,
                    TRANSACTIONTYPE tinyint,
                    NAME nvarchar(100),
                    SEQUENCE int,
                    SELECTED bit
                );

                insert into @TRANSACTIONTYPES
                    select
                        T.c.value('(ID)[1]', 'uniqueidentifier'),
                        T.c.value('(PARENTID)[1]', 'uniqueidentifier'),
                        T.c.value('(APPLICATION)[1]', 'tinyint'),
                        T.c.value('(TRANSACTIONTYPE)[1]', 'tinyint'),
                        T.c.value('(NAME)[1]', 'nvarchar(100)'),
                        T.c.value('(SEQUENCE)[1]', 'int'),
                        T.c.value('(SELECTED)[1]', 'bit')
                    from @TRANSACTIONTYPECODES.nodes('/TRANSACTIONTYPECODES/ITEM') T(c)

                select @SELECTIONS = 
                (
                    select
                        ID,PARENTID,APPLICATION,TRANSACTIONTYPE,NAME,SEQUENCE,SELECTED
                    from @TRANSACTIONTYPES
                    for xml raw('ITEM'),type,elements,root('SELECTIONS'),BINARY BASE64
                )
                return 0;