Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and Listretriving data from UDT tables and pass it to ReportViewerretriving data from UDT tables and pass it to ReportViewer
Previous
 
Next
New Post
12/27/2011 2:35 PM
 

hi, and thanx in advance

im trying to integrate the ReportViewer control into my DNN website.

i allready have the form and list module full off data, and i want to get the data from the module and pass it to the ReportViewer control.

the idea here is when i use this select statement on a DataSet:

SELECT R.UserDefinedRowId,
F.FieldTitle,
D.FieldValue
FROM dbo.UserDefinedRows R
LEFT OUTER JOIN dbo.UserDefinedData D on R.UserDefinedRowId = D.UserDefinedRowId
INNER JOIN dbo.UserDefinedFields F on D.UserDefinedFieldId = F.UserDefinedFieldId
WHERE R.ModuleId = ---
ORDER by R.UserDefinedRowID

i get the data, but it's not in a shape that i can use

i need a query to view my data like a table ( like the view on the Form and List Module)

so where can i find the query that the module (Form and List) use to view the data on the website  ????

cos i can use the same query.

thank you very much

 
New Post
12/30/2011 8:51 PM
 
Hi Helmi

The stored procedure used to populate the web table is similar to yours - a lot of work has to be done to turn it into a table! I have written several routines and functions to do this in SQL Server. For each F&L module, I create an entry in the procedure below which maps out the columns in the specific web table corresponding to the specific F&L module instance..

ALTER PROCEDURE [dbo].[ST4WDC_ReportFormAndListModules] @PortalID INT, @ModuleTitle NVARCHAR (256) AS BEGIN

SET NOCOUNT ON;

IF @ModuleTitle = 'Participants' BEGIN
SELECT
m.ModuleID,
m.ModuleTitle,
r.UserDefinedRowId,
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Tag')) AS 'Tag',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Event')) AS 'Event',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Participant 1')) AS 'Participant 1',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Fin')) AS 'Fin',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Training 1')) AS 'Training 1',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Status')) AS 'Status',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Participant 2')) AS 'Participant 2',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Vehicle')) AS 'Vehicle',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Trailer')) AS 'Trailer',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Others')) AS 'Others',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Created by')) AS 'Created by',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Created at')) AS 'Created at',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Changed by')) AS 'Changed by',
dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Changed at')) AS 'Changed at'
FROM dbo.UserDefinedRows r
LEFT OUTER JOIN dbo.Modules m
ON m.ModuleID = r.ModuleID
WHERE m.ModuleTitle = @ModuleTitle
AND m.IsDeleted = 0
AND m.PortalID = 0
ORDER BY m.ModuleID, dbo.ST4WDCexpandData (@PortalID, r.UserDefinedRowId, dbo.ST4WDC_FieldID (0, m.ModuleID, 'Event'))
RETURN
END
-- repeat for each module instance
END

The supporting functions are:

ALTER FUNCTION [dbo].[ST4WDC_FieldID] (@PortalID INT, @ModuleID INT, @FieldTitle NVARCHAR (50)) RETURNS INT AS BEGIN

RETURN (SELECT UserDefinedFieldID FROM dbo.UserDefinedFields WHERE ModuleID = @ModuleID AND FieldTitle = @FieldTitle)
END


ALTER FUNCTION [dbo].[ST4WDCexpandData] (@PortalID INT, @UserDefinedRowId INT, @UserDefinedFieldID INT) RETURNS NVARCHAR (MAX) AS BEGIN

DECLARE @ModuleID INT = (SELECT ModuleId FROM dbo.UserDefinedRows WHERE UserDefinedRowId = @UserDefinedRowId)
DECLARE @Visible BIT = (SELECT Visible FROM dbo.UserDefinedFields WHERE UserDefinedFieldId = @UserDefinedFieldID)
DECLARE @FieldType VARCHAR (20) = (SELECT FieldType FROM dbo.UserDefinedFields WHERE UserDefinedFieldId = @UserDefinedFieldID)
DECLARE @FieldTitle NVARCHAR (50) = (SELECT FieldTitle FROM dbo.UserDefinedFields WHERE UserDefinedFieldId = @UserDefinedFieldID)
DECLARE @FieldValue NVARCHAR (MAX) = (SELECT FieldValue FROM dbo.UserDefinedData WHERE UserDefinedRowID = @UserDefinedRowID AND UserDefinedFieldID = @UserDefinedFieldID)
DECLARE @InputSettings NVARCHAR (2000) = (SELECT InputSettings FROM dbo.UserDefinedFields WHERE UserDefinedFieldId = @UserDefinedFieldID)
DECLARE @Default NVARCHAR (2000) = (SELECT "Default" FROM dbo.UserDefinedFields WHERE UserDefinedFieldId = @UserDefinedFieldID)
DECLARE @Field NVARCHAR (MAX)

SET @Field = CASE
WHEN @FieldType IN ( 'Boolean', 'ChangedAt', 'ChangedBy', 'CreatedAt', 'CreatedBy', 'Currency', 'Decimal', 'EMail', 'Int32', 'String', 'TextHTML' )
THEN @FieldValue
WHEN @FieldType IN ( 'Date' )
THEN CONVERT (NVARCHAR (11), CAST (@FieldValue AS DATETIME), 106) --1995-06-10T00:00:00
WHEN @FieldType IN ( 'LookUp' )
THEN dbo.ST4WDCprofileValue (@PortalID, @Default, dbo.ST4WDCgetListData (@ModuleID, @InputSettings, @UserDefinedRowId))
WHEN @FieldType IN ( 'URL' )
THEN CASE
WHEN REPLACE (REPLACE (REPLACE (REPLACE (REPLACE (REPLACE (REPLACE (REPLACE (REPLACE (REPLACE
(@FieldValue, '9', ''), '8', ''), '7', ''), '6', ''), '5', ''), '4', ''), '3', ''), '2', ''), '1', ''), '0', '') = ''
THEN (SELECT TabName FROM dbo.Tabs WHERE TabID = CAST (@FieldValue AS INT))
ELSE @FieldValue
END
WHEN @FieldType IN ( 'UserLink' ) -- UserID=234
THEN (SELECT DisplayName FROM dbo.Users WHERE UserID = dbo.ST4WDCgetFirstInteger (@FieldValue))
WHEN @FieldType IS NULL -- could have been a lookup so this test comes after that one
THEN ''
ELSE 'Unknown Field Type'
END

IF @Field IS NULL RETURN ''
RETURN @Field
END

ALTER FUNCTION [dbo].[ST4WDCgetFirstInteger] (@string NVARCHAR (MAX)) RETURNS INT AS BEGIN

DECLARE @result NVARCHAR (MAX)
DECLARE @start INT = PATINDEX ('%[01234567890]%', @string)
DECLARE @end INT = PATINDEX ('%[^0123456789]%', SUBSTRING (@string, @start, 2000))

RETURN
CASE
WHEN @start = 0
THEN NULL
WHEN @end = 0
THEN CAST (SUBSTRING (@string, @start, LEN (@string) - @start + 1) AS INT)
ELSE CAST (SUBSTRING (@string, @start, @end - 1) AS INT)
END
--SELECT dbo.ST4WDCgetFirstInteger ('userID=32|crap')
--SELECT dbo.ST4WDCgetFirstInteger ('userID=|crap')
--SELECT dbo.ST4WDCgetFirstInteger ('userID=3')
--SELECT dbo.ST4WDCgetFirstInteger ('3crap')
--SELECT dbo.ST4WDCgetFirstInteger ('')

END

Hope this helps

Richard
 
New Post
12/31/2011 8:14 AM
 
First: there are no enough words to thank you.
thank you very very very much
Second: your reply is very helpful
but i want to ask you
is there any way to find the Select statement that the F&L Module use
like the Data Source Adapter.
i would like to use the same Select statement that the module use

thank you very much again
 
New Post
12/31/2011 8:19 AM
 

First: i dont know how to thank you.

thank you very very very much.

Second: your reply is very helpful. but

is there anyway to find the exact Select statement that the F&L Module use??? like a Data source adapter or any other ways???

i would like to use the same exact statement that the module use.

thanks again

your help is very much appreciated.

 
New Post
12/31/2011 3:12 PM
 
Hi Helmi

FnL uses just three tables to store all the data required to construct raw representations of every instance of every FnL module on an installation.

The dbo.UserDefinedRows table has two columns only: UserDefinedRowId and ModuleId.

The dbo.UserDefinedData table has three columns: dbo.UserDefinedFieldID, dbo.UserDefinedRowID and FieldValue. The last is of type NTEXT so it has to be converted before much can be done with it!

The dbo.UserDefinedFields table has 18 fields, which define the columns for each module - things like the ModuleID, FieldOrder, FieldTitle and validation settings.

The standard SQL stored procedure to retrieve all rows in a FnL module is:

ALTER PROCEDURE [dbo].[UserDefinedTable_GetRows]
@ModuleId int
AS
SELECT R.UserDefinedRowId,
F.FieldTitle,
D.FieldValue
FROM dbo.UserDefinedRows R
LEFT OUTER JOIN dbo.UserDefinedData D on R.UserDefinedRowId = D.UserDefinedRowId
INNER JOIN dbo.UserDefinedFields F on D.UserDefinedFieldId = F.UserDefinedFieldId
WHERE R.ModuleId = @ModuleId
ORDER by R.UserDefinedRowID

This retrieves the raw contents of each cell, in row order, so it is pretty useless in terms of trying to display something that looks like a list as displayed on the web.

A complication is that the raw values returned for field types URL, LookUp and UserLink need a lot of interpretation to get at the values that are displayed on the web. For example, a UserLink is encoded as 'UserID=nnn' where nnn is the UserID in the dbo.Users table. If the link is required to open in a new window, '|w' is appended so the raw value could be 'UserID=32|w'.

Similarly, URL is encoded with the page (tab) number if it is a page on the site, so might have the raw value '328'. Other URLs actually are recognisable as URLs.

The FnL module reads all the raw data for a module into a .NET dataset. It then has to interpret URLs, LookUps and UserLinks, so for each data cell of these types it may have to query the database. Extra columns are added to the dataset to hold the results. Only when the entire dataset has been populated and expanded are filters and search terms applied, which is why the standard FnL module becomes very slow when there are lots of URLs, LookUps and UserLinks.

Finally, the same FnL module may appear with different settings, such as filters, in many places. The settings are held in the dbo.TabModuleSettings table. Unfortunately there is no way to discover which TabModuleSettings are required at the time the data is retrieved, because only the ModuleId is supplied, not the TabModuleId.

Hope this helps

Richard
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and Listretriving data from UDT tables and pass it to ReportViewerretriving data from UDT tables and pass it to ReportViewer


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out