Great Ideas. Always Flowing.

We are not happy until you are happy. Client satisfaction guaranteed. Whatever your needs and requirements, we have the skills and resources for the job!

Quick login...


Or... now make it easy with Facebook Integration
Connect via Facebook



Top Sellers

Frustrated over the lack of customization for your user's registration fields? Dynamically setup your DNN Portal with custom registration fields, layout, questions, and other core integration options......

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to upload videos in various format and automatically encode them to flv or H264 format, you also can add videos from internet or record live videos from your webcam.

Build high performance, completely customizable data-entry forms and views driven by your DNN and external databases. New built-in tools make it a snap to quickly create data entry forms, data views, and even database tables. Plus, add your own HTML, CSS, Javascript, SQL commands, stored procedures,

The most advanced DotNetNuke shopping cart on the planet. Easy to use e-Commerce, Secure Shopping Cart Software and SEO friendly. B2C / B2B Ecommerce Sites.

One stop solution for events calendar and events registration! FREE DOWNLOAD is available now!

Displaying results
Last Post 08-27-2011 11:03 AM by Chad Nash. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Mark ChamberlainUser is Offline
skipping stones
skipping stones
Posts:7
Avatar

--
08-26-2011 01:10 PM
    Greetings-

    Some of our uses for Dynamic Forms have needed a more "friendly" report out of the database than what I have been able to discover.  I wrote the following stored procedure that gets them exactly to what we want, I wanted to provide it as a resource and starting point for possibly including some different report options in the future.  It won't support gargantuan forms due to limitations on string length, I tried to help by abbreviating names in the dynamic SQL.  You can also cram more fields in the report if you keep the short question names uh...short!  Thanks for a great product, enjoy!

    Mark

    USE [DotNetNuke]
    GO
    /****** Object:  StoredProcedure [dbo].[DynamicFormsCustom_GetFormResponses]    Script Date: 08/26/2011 17:52:17 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[DynamicFormsCustom_GetFormResponses] @ModuleID INT
    AS

    DECLARE
        @QuestionList TABLE
            (DynamicQuestionID UNIQUEIDENTIFIER,
            Question NVARCHAR(4000),
            ShortFieldName NVARCHAR(255),
            SortOrder INT,
            QuestionID INT)

    INSERT INTO    @QuestionList
        (DynamicQuestionID,
        Question,
        ShortFieldName,
        SortOrder)
    SELECT
        DynamicQuestionID,
        Question,
        ShortFieldName,
        SortOrder
    FROM
        DotNetNuke.dbo.DynamicForms_Question
    WHERE
        ModuleID = @ModuleID AND
        QuestionType NOT IN ('HTML','HR','button','label') AND
        InActive = 0

    DECLARE
        @CurrentDynamicQuestionID UNIQUEIDENTIFIER,
        @QuestionIDIterator INT,
        @QuestionIDIteratorMAX INT

    SELECT TOP 1
        @CurrentDynamicQuestionID = DynamicQuestionID
    FROM
        @QuestionList
    WHERE
        QuestionID IS NULL
    ORDER BY
        SortOrder ASC

    SET @QuestionIDIterator = -1

    WHILE @CurrentDynamicQuestionID IS NOT NULL
        BEGIN
        SET @QuestionIDIterator = @QuestionIDIterator + 1
        SET @QuestionIDIteratorMAX = @QuestionIDIterator

        UPDATE
            @QuestionList
        SET
            QuestionID = @QuestionIDIterator
        WHERE
            DynamicQuestionID = @CurrentDynamicQuestionID

        SET @CurrentDynamicQuestionID = NULL

        SELECT TOP 1
            @CurrentDynamicQuestionID = DynamicQuestionID
        FROM
            @QuestionList
        WHERE
            QuestionID IS NULL
        ORDER BY
            SortOrder ASC
        END

    DECLARE
        @DynamicSQL VARCHAR(8000)

    SET @DynamicSQL = '
    DECLARE
        @UR TABLE
            (UniqueResponseID UNIQUEIDENTIFIER,
            ResponseDateTime SMALLDATETIME,
            UserID INT,
            Username NVARCHAR(100),
            Email NVARCHAR(256),
            DisplayName NVARCHAR(128))

    INSERT INTO @UR
        (UniqueResponseID,
        ResponseDateTime,
        UserID,
        Username,
        Email,
        DisplayName)
    SELECT DISTINCT
        QR.UniqueResponseID,
        QR.ResponseDateTime,
        QR.UserID,
        U.Username,
        U.Email,
        U.DisplayName
    FROM
        DotNetNuke.dbo.DynamicForms_Question QL
        INNER JOIN DotNetNuke.dbo.DynamicForms_QuestionResponse QR ON QR.DynamicQuestionID = QL.DynamicQuestionID
        LEFT OUTER JOIN DotNetNuke.dbo.Users U ON U.UserID = QR.UserID
    WHERE
        QL.ModuleID = ' + CONVERT(VARCHAR, @ModuleID) + ' AND
        QL.QuestionType NOT IN (''HTML'',''HR'',''button'',''label'') AND
        QL.InActive = 0

    SELECT
        UR.ResponseDateTime AS ''Timestamp'',
        UR.Username AS ''UserName'',
        UR.Email AS ''UserEMail'',
        UR.DisplayName AS ''UserDisplayName'', '

    SET @QuestionIDIterator = -1

    DECLARE
        @CurrentQuestionShortFieldName NVARCHAR(255)

    WHILE @QuestionIDIterator < @QuestionIDIteratorMAX
        BEGIN
        SET @QuestionIDIterator = @QuestionIDIterator + 1
       
        SELECT
            @CurrentQuestionShortFieldName = ShortFieldName
        FROM
            @QuestionList
        WHERE
            QuestionID = @QuestionIDIterator

        SET @DynamicSQL = @DynamicSQL + 'Q' + CONVERT(VARCHAR, @QuestionIDIterator) + '.Response AS ''' + @CurrentQuestionShortFieldName + ''''

        IF @QuestionIDIterator < @QuestionIDIteratorMAX
            BEGIN
            SET @DynamicSQL = @DynamicSQL + ','
            END
        SET @DynamicSQL = @DynamicSQL + ' '
        END


    SET @DynamicSQL = @DynamicSQL + '
    FROM
        @UR UR '

    SET @QuestionIDIterator = -1

    DECLARE
        @CurrentQuestionDynamicQuestionID UNIQUEIDENTIFIER

    WHILE @QuestionIDIterator < @QuestionIDIteratorMAX
        BEGIN
        SET @QuestionIDIterator = @QuestionIDIterator + 1

        SELECT
            @CurrentQuestionDynamicQuestionID = DynamicQuestionID
        FROM
            @QuestionList
        WHERE
            QuestionID = @QuestionIDIterator

        SET @DynamicSQL = @DynamicSQL + 'LEFT OUTER JOIN DotNetNuke.dbo.DynamicForms_QuestionResponse Q' + CONVERT(VARCHAR, @QuestionIDIterator) + ' ON Q' + CONVERT(VARCHAR, @QuestionIDIterator) + '.UniqueResponseID = UR.UniqueResponseID AND Q' + CONVERT(VARCHAR, @QuestionIDIterator) + '.DynamicQuestionID = ''' + CONVERT(VARCHAR(255), @CurrentQuestionDynamicQuestionID) + ''' '
        END

    SET @DynamicSQL = @DynamicSQL + '
    ORDER BY
        UR.ResponseDateTime DESC,
        UR.UniqueResponseID ASC'

    EXECUTE (@DynamicSQL)

    Chad NashUser is Offline
    Posts:5260
    Avatar

    --
    08-27-2011 11:03 AM
    Hi Mark - Thank you for posting such a useful query! I am sure this will be helpful for otheres.

    -Chad
    You are not authorized to post a reply.


     
     

    Join our mailing list...

    Get current news and events the easy way
    Subscribe Me

    Recent Blogs...

     
    Copyright 2005 - 2011 by Data Springs, Inc.
     
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi