Quantcast
Channel: Dynamics GP - Learn & Discuss » Dexterity
Viewing all articles
Browse latest Browse all 17

Simulate DEX_ROW_ID in a SQL View Using ROW_NUMBER() – #MSDYNGP

$
0
0

I have a requirement in which I have to access a SQL view from within my customisation dictionary, in order to create a custom lookup for users to select a value based on an Extender form and an Extender lookup. Easiest option is to create an Extender view (which in turn creates a SQL view for us).

Now, this is the view that I am suppose to refer to from my custom dictionary. Dexterity allows us to refer to any SQL object by simply create a TABLE definition and mention the SQL object (table or view) name as the physical name.

Dex View

Everything looks perfect till you actually see below error messages at runtime:

Dex View - Error 1

Dex View - Error 2

Error message is quite obvious; you do not have DEX_ROW_ID in that SQL view that you are referring to. Every single Dexterity table must have DEX_ROW_ID at the backend. It cannot afford to not have one.

So how am I going to resolve this? By simply adding a record number dynamically to the SQL view created by Extender. How to do that? By adding the T-SQL function ROW_NUMBER(). This is how I achieved it:

ROW_NUMBER USAGE

 

Definition of ROW_NUMBER() can be found here: ROW_NUMBER (Transact-SQL).

A simple yet powerful SQL function has given me the power to do what I wanted in no time. Oh, and my custom lookup referring to this view is working like a charm. Users are happy and so am I.

VAIDY


Filed under: #MSDYNGP, Dex, Dexterity, Dexterity Programming, DEX_ROW_ID, GP, Microsoft Dynamics GP, SQL, SQL Programming, SQL Queries, SQL Server, SQL Views, T-SQL

Viewing all articles
Browse latest Browse all 17

Latest Images

Trending Articles





Latest Images