Microsoft Dynamics GP Developing for Dynamics GP
A blog dedicated to the Microsoft Dynamics GP Developer & Consultant community
 
Welcome to MSDN Blogs Sign in | Join | Help

Developing for Dynamics GP

by David Musgrave (Australia) and the Microsoft Dynamics GP Developer Support Team (USA)

News

  • Please use the Blog Feedback? - Contact Us link at the top of the page to email questions relating to the blog itself.

    If you wish to ask a technical question, please use the links below to ask on the Newsgroups. If you ask on the Newsgroups, others in the community can respond and the answers are available for everyone in the future.

    Please do not use comments on pages and posts to ask questions unrelated to the topic on that page or post.



    Dates of Interest:

    11-Jul-2008: Blog Created by David Musgrave.
    10-Oct-2008: First Post by Scott Stephenson.
    04-Nov-2008: First Post by Dave Dusek.
    11-Nov-2008: First Post by Beth Gardner.
    28-Nov-2008: First Post by Chris Roehrich.
    30-Dec-2008: First Post by Patrick Roth.
    24-Feb-2009: First Post by Greg Willson.
    22-Apr-2009: First Post by David Clauson.
    04-May-2009: First Post by Ryan Wigestrand.
    19-Jun-2009: First Post by Dawn Langlie.
    03-Jul-2009: First Post by Emily Halvorson.
    23-Sep-2009: Created Twitter account with blog feed.
    20-Nov-2009: First Post by Alice Newsam.



    WorldMaps Statistics since
    24-Feb-2009:




    Click for WorldMaps Stumbler



    Translator Tool:




    Social Networking

    Follow David Musgrave and the blog on:

    David Musgrave on Twitter

    David Musgrave on LinkedIn


    Disclaimer

    This blog is provided "AS IS" with no warranties, and confers no rights.

    The links in this blog may lead to third-party Web sites. Microsoft provides third-party resources to help you find customer service and/or technical support resources. Information at these sites may change without notice. Microsoft is not responsible for the content at any third-party Web sites and does not guarantee the accuracy of third-party information.

Contents

Favourite Posts

Blog Links

Newsgroups Links

Resources Links

Creating SQL Views of Extender Data

David MeegoExtender can create SQL views of the data in an Extender window which allows the data to be viewed as a single row in the view even though the actual data is stored as a multiple records across multiple tables (depending on data type).

This view can then be used by SmartList Builder to show the Extender data in SmartList.

However, the views created by Extender have a number of issues with them that makes them less than perfect.

  • If the data for the first field is missing from the table, no data will be shown even if it exists for other fields.
     
  • If the data for any of the other fields is missing from the table, a NULL will be returned.  Dexterity does not understand the concept of NULL and will not be happy with a NULL being returned.
     
  • If the labels for a List field are edited, the view will show the old values until the view is generated again. This is because it hard codes the list labels into a case/if statement.
     

An alternative is to code your own view which overcomes these issue by working of the key value in the PT_Extender_Window_Key_Values (EXT00100) table as the primary table for the join.  It also has isnull() handling for the missing data and populates list labels dynamically from the setup table.


I have used Extender to add a Details window to the Customer Maintenance window with one field of each of the major data types.  The screenshot is displayed below:

Extender Details Window 

I then created a SQL view using the following code:

Code for MBS_ExtenderDetails SQL View Example

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MBS_ExtenderDetails]') and OBJECTPROPERTY(id, N'IsView') = 1)

drop view [dbo].[MBS_ExtenderDetails]

GO

create view MBS_ExtenderDetails

as

select X0.PT_Window_ID
     , X0.PT_UD_Key as [Key Field]
--   , isnull(X1.TOTAL,0) as [Checkbox Value]
     , case isnull(X1.TOTAL,0) when 1 then 'true' else 'false' end as [Checkbox]
     , isnull(X2.TOTAL,0) as [Currency]
     , isnull(X3.DATE1,'1900-01-01 00:00:00') as [Date]
--   , isnull(X4.TOTAL,0) as [List Value]
     , isnull(XL4.LONGNAME,'') as [List]
     , isnull(X5.TOTAL,0) as [Number]
     , isnull(X6.STRGA255,'') as [Short String]
     , isnull(X7.TIME1,'1900-01-01 00:00:00') as [Time]
     , isnull(X8.STRGA255,'') as [Long String]

from EXT00100 X0

-- Checkbox stored in Number table EXT00103
left join EXT00103 X1 on X1.PT_Window_ID = X0.PT_Window_ID and X1.PT_UD_Key = X0.PT_UD_Key and X1.PT_UD_Number = 1
-- Currency stored in Number table EXT00103
left join EXT00103 X2 on X2.PT_Window_ID = X0.PT_Window_ID and X2.PT_UD_Key = X0.PT_UD_Key and X2.PT_UD_Number = 2
-- Date stored in Date table EXT00102
left join EXT00102 X3 on X3.PT_Window_ID = X0.PT_Window_ID and X3.PT_UD_Key = X0.PT_UD_Key and X3.PT_UD_Number = 3
-- List Value stored in Number table EXT00103 with Lookup to List Setup table EXT40102
left join EXT00103 X4
     inner join EXT40102 XL4 on XL4.PT_Window_ID = X4.PT_Window_ID and XL4.Field_Number = X4.PT_UD_Number and XL4.LNITMSEQ = X4.TOTAL
     on X4.PT_Window_ID = X0.PT_Window_ID and X4.PT_UD_Key = X0.PT_UD_Key and X4.PT_UD_Number = 4
-- Number stored in Number table EXT00103
left join EXT00103 X5 on X5.PT_Window_ID = X0.PT_Window_ID and X5.PT_UD_Key = X0.PT_UD_Key and X5.PT_UD_Number = 5
-- Short String stored in String table EXT00101
left join EXT00101 X6 on X6.PT_Window_ID = X0.PT_Window_ID and X6.PT_UD_Key = X0.PT_UD_Key and X6.PT_UD_Number = 6
-- Time stored in Time table EXT00104
left join EXT00104 X7 on X7.PT_Window_ID = X0.PT_Window_ID and X7.PT_UD_Key = X0.PT_UD_Key and X7.PT_UD_Number = 7
-- Long String stored in String table EXT00101
left join EXT00101 X8 on X8.PT_Window_ID = X0.PT_Window_ID and X8.PT_UD_Key = X0.PT_UD_Key and X8.PT_UD_Number = 8

-- Name of the Extender ID for the window
where
X0.PT_Window_ID = 'DETAILS'

GO

GRANT SELECT , INSERT , DELETE , UPDATE ON [dbo].[MBS_ExtenderDetails] TO [DYNGRP]

GO

select * from MBS_ExtenderDetails

 

This is the output from the view based on the data shown in the screenshot above:

SQL View Output

PT_Window_ID  Key Field     Checkbox  Currency  Date                     List         Number       Short String            Time                     Long String          
------------- ------------- --------- --------- ------------------------ ------------ ------------ ----------------------- ------------------------ ----------------------
DETAILS       AARONFIT0001  true      10.00000  1968-06-06 00:00:00.000  List Item B  12345.00000  This is a short string  1900-01-01 10:10:10.000  This is a long string

 

The SQL Script for the MBS_ExtenderDetails view as well as the exported Extender Details window and a test view are attached at the bottom of this article.


The example here shows one field of each data type coming from one of the four tables:

  • EXT00101 - PT_User_Window_Field_Strings
  • EXT00102 - PT_User_Window_Field_Dates
  • EXT00103 - PT_User_Window_Field_Numbers
  • EXT00104 - PT_User_Window_Field_Times

If this was for a Detail window you would need to change the view to use the Detail tables:

  • EXT00181 - PT_Detail_Window_Field_Strings
  • EXT00182 - PT_Detail_Window_Field_Dates
  • EXT00183 - PT_Detail_Window_Field_Numbers
  • EXT00184 - PT_Detail_Window_Field_Times

You would also need to change the view to use the PT_Extender_Detail_Window_Key_Values (EXT00185) and PT_UD_Details_Window_Lines (EXT00180) tables instead of the PT_Extender_Window_Key_Values (EXT00100) table for the main join.

You should be able to take this example code and adjust it to work with any Extender data you have.  Then you can join this view with any other tables you need to to create complex views that can be used with SmartList Builder, SQL Reporting Services or Crystal Reports.

David

Posted: Friday, February 06, 2009 9:00 AM by David Musgrave
Attachment(s): SQL Extender View Demo.zip

Comments

Victoria Yudin said:

Something I have been asked more than a few times is how to use a SQL view in SmartList Builder to create

# April 20, 2009 1:29 PM

DynamicAccounting.net said:

Reporting off of Extender is a significant source of foul language in the GP world. Now Mariano is continuing

# April 26, 2009 10:34 AM

Jason said:

Anyone report off of non-company databases without creating every GP user in that company?  We have a custom database that I want to access through smartlist builder but can't because of the user I am logged in as in GP isn't available in the target DB.

Thanks,

Jason

# May 12, 2009 2:18 PM

Shelley Williams said:

Is there any way to create a Go To that will open this Details window directly, without having to open the Customer Maintenance window first?

Thank you,

Shelley Williams

# May 28, 2009 2:33 PM

Patrick Roth [MSFT] said:

Shelley,

It doesn't look like it.  While we don't own Extender (it is OEM'd) and don't have source for it, you can tell a lot from a script.log and about 12 years experience using Dexterity.

But looking at the script.log, the extender window itself is what is pulling the key values from the window.  That is unfortunate since if it was passed the key values then this would have worked.  But since it looks towards the real window, it isn't open and therefore doesn't know what to get.

Indeed, when I tried this my key values showed as "0" instead of the blank strings I expected.  No errors, just didn't work.

patrick

# May 28, 2009 11:24 PM

Daniel said:

Is there documentation that explains the data tables and transaction flow of Extender

Thanks

Dan

# July 28, 2009 5:16 PM

David Musgrave said:

Hi Dan

From what I can see Extender Tables not covered in the SDK.

So you would need to look at the Table Resources functionality built into the Dynamics GP application for information on the tables.

David

# July 29, 2009 3:41 AM

Sheila said:

I don't see that anyone ever answered Jason. Is this possible? I'm trying to do the same thing.

"Anyone report off of non-company databases without creating every GP user in that company?  We have a custom database that I want to access through smartlist builder but can't because of the user I am logged in as in GP isn't available in the target DB."

# October 8, 2009 2:09 PM

Patrick Roth [MSFT] said:

Sheila/Jason,

Obviously you cannot query a table in a database if the user doesn't have SQL access to that database.

From a SQL view perspective, I believe that the user would need access to that other db even if the view originated in a company they did have access to.

I don't think that is the case for a stored procedure however but it doesn't matter because the question was in regards to SLB which cannot execute procs.

# October 8, 2009 2:51 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker