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 ListReporting against the UDT ModuleReporting against the UDT Module
Previous
 
Next
New Post
9/12/2006 9:55 AM
 

I am trying to write an SQL query in the Reports Module to leverage some of the User Defined Table fields that I created and I can not figure out what the table name would be for my Select statement. So far I go the following set up:

User Defined Table Fields:
City, State, Zip

SQL Query:
SELECT City, State, Zip
FROM (This is where I need the table name)

Any help would be appreciated!

 
New Post
9/12/2006 10:46 AM
 

UDT has its own storage format, that is not natively supported by the reports module. It stores data serialized one field per record in UserDefinedData.

To get all field values for "City" you can either lookup column ID in UserDefinedFields and use Id or Join both tables (first solution is easier).

If FieldID for City = 9, FieldID for State = 10, FieldID for Zip = 11 you ca query all three fields like:

SELECT C.FieldValue AS City, S.FieldValue AS State, Z.FieldValue AS Zip
FROM UserDefinedData AS C INNER JOIN (UserDefinedData AS S INNER JOIN UserDefinedData AS Z ON s.UserDefinedRowId = Z.UserDefinedRowId) ON C.UserDefinedRowId = S.UserDefinedRowId
WHERE C.UserDefinedFieldId = 9 AND S.UserDefinedFieldId = 10 AND Z.UserDefinedFieldId =11

Note, that all 3 fields must be filled out (use outer Join, if you want to include empty values as well).


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
9/12/2006 7:07 PM
 

leupold,

Thanks for the info. It worked perfectly! Ahead of time I apologize for the novice follow-up on my part. My exact SQL is below. I need to know how I would include additional fields into this query. My SQL is a bit junior and  I have a larger field set. Also, I want to create additional tables to do this with as well.

SELECT C.FieldValue AS City, S.FieldValue AS State, Z.FieldValue AS Zip
FROM UserDefinedData AS C INNER JOIN (UserDefinedData AS S INNER JOIN UserDefinedData AS Z ON s.UserDefinedRowId = Z.UserDefinedRowId) ON C.UserDefinedRowId = S.UserDefinedRowId
WHERE C.UserDefinedFieldId = 39 AND S.UserDefinedFieldId = 40 AND Z.UserDefinedFieldId =41

Thank you for any assistance.

 
New Post
9/13/2006 3:49 AM
 
DezzyNez wrote

leupold,

Thanks for the info. It worked perfectly! Ahead of time I apologize for the novice follow-up on my part. My exact SQL is below. I need to know how I would include additional fields into this query. My SQL is a bit junior and  I have a larger field set. Also, I want to create additional tables to do this with as well.

SELECT C.FieldValue AS City, S.FieldValue AS State, Z.FieldValue AS Zip
FROM UserDefinedData AS C INNER JOIN (UserDefinedData AS S INNER JOIN UserDefinedData AS Z ON s.UserDefinedRowId = Z.UserDefinedRowId) ON C.UserDefinedRowId = S.UserDefinedRowId
WHERE C.UserDefinedFieldId = 39 AND S.UserDefinedFieldId = 40 AND Z.UserDefinedFieldId =41

Thank you for any assistance.

For each field you need to rejoin the UserDefinedDataTable:

SELECT C.FieldValue AS City, S.FieldValue AS State, Z.FieldValue AS Zip, A.FieldValue AS AnyOther 
FROM UserDefinedData AS C INNER JOIN (UserDefinedData AS S INNER JOIN (UserDefinedData AS Z INNER JOIN UserDefinedData AS A ON Z.UserDefinedRowId = A.UserDefinedRowId) ON s.UserDefinedRowId = Z.UserDefinedRowId) ON C.UserDefinedRowId = S.UserDefinedRowId
WHERE C.UserDefinedFieldId = 39 AND S.UserDefinedFieldId = 40 AND Z.UserDefinedFieldId =41 AND Z.UserDefinedFieldId=42

If you are using MS SQL 2005 you can also try using the PIVOT statement to create an appropriate tabular recordset. If you are giong to fill a DataSet in DotNetNuke use the provided Function BuildCrossTabDataSet instead.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
12/6/2006 1:41 AM
 
I have not been able to make this work with empty fields, i've tried outer joins with no luck. Any other suggestions?
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListReporting against the UDT ModuleReporting against the UDT Module


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