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 Listsql query /stored proc to get data from udt in another web app non dnnsql query /stored proc to get data from udt in another web app non dnn
Previous
 
Next
New Post
9/27/2007 5:42 AM
 

HI

In order to get data from my udt i have the following query

select *
,      (SELECT TOP 1 CAST(udd.[FieldValue] AS varchar(500))
        FROM   UserDefinedData   udd
        ,      userdefinedfields udf
        WHERE  udd.[UserDefinedRowId]   = udr.[UserDefinedRowId]
        AND    udd.[UserDefinedFieldId] = udf.[UserDefinedFieldId]
        AND    udf.[ModuleId]           = udr.[ModuleId]
        AND    udf.[FieldTitle] = 'Ttitle'
       ) AS [Title]
,      (SELECT TOP 1 CAST(udd.[FieldValue] AS varchar(500))
        FROM   UserDefinedData   udd
        ,      userdefinedfields udf
        WHERE  udd.[UserDefinedRowId]   = udr.[UserDefinedRowId]
        AND    udd.[UserDefinedFieldId] = udf.[UserDefinedFieldId]
        AND    udf.[ModuleId]           = udr.[ModuleId]
        AND    udf.[FieldTitle] = 'url'
       ) AS [url]
FROM   [userdefinedrows] udr
WHERE  udr.[moduleid] = 610
ORDER BY UserDefinedRowId ASC

this  gives me the following  dataset i can call from another webapp to get the content from there.

 

The downside of this one is that i need to add a query fro each userdefined field in the udt. Has anyone done this before and is there a better way to do it so that i just can enter a moduleid and get the results back  as a usuable dataset

 

thanks in advance

 

Armand

UserDefinedRowId      ModuleId      Title                                                url

4                                  610               Automatisering Gids Studiereis       http:/www.whatever.nl 

etc.

 
New Post
9/27/2007 6:25 AM
 

Armand, you shold  use this:

        SELECT  d1.UserDefinedRowId, F1.ModuleId, d1.FieldValue AS [Title], d2.FieldValue AS URL
        FROM   UserDefinedData   d1 
        INNER JOIN
UserDefinedFields f1 ON d1.UserDefinedFieldId = f1.UserDefinedFieldId
        INNER JOIN UserDefinedData d2 ON d1.UserDefinedRowId = d2.UserDefinedRowId
        INNER JOIN UserDefinedFields f2 ON d2.UserDefinedFieldId = f2.UserDefinedFieldId
        WHERE    f1.[ModuleId]   =   610
        AND    f1.FieldTitle = 'Title'
        AND    f2.FieldTitle = 'URL'
        ORDER BY d1.UserDefinedRowId

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
9/27/2007 6:48 AM
 

The upper sql only works if all fields are set. It will fail if e.g the URL is NULL (or even an empty string).

If you want to retrieve the dataset, use VB.NET and you issue is handled with UserDefinedTableController.GetDataSet(ModuleID)

 
New Post
1/28/2008 1:12 AM
 

When I tried to  use this query I received the following error when I ran "test Data Source":

There was an error executing the data source: There is an error in your SQL at line 3: 'UserDefinedFields' is not a recognized join option.

 
New Post
1/28/2008 4:31 AM
 

sorry, i added missing keyword "JOIN"


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and Listsql query /stored proc to get data from udt in another web app non dnnsql query /stored proc to get data from udt in another web app non dnn


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