another blog

Icon

About Microsoft Dynamics GP :-)

Getting the current open window in .net GP Add In

There are many ways of getting information of active window in GP, but it changes according to the developing tool we are working on.

1.Dexterity.(the best tool 🙂 <3)

2.VS Tools For Dynamics GP

2.Continuum API (and so adding reference of this API in Custom Visual Studio AddIn.)

1.Dexterity provide various function, with the help of the combination of those functions we can find the active window information. Or we can also use COM objects to do the same.All we need to do is to add a COM Type Library and then use the objects and properties.

2.VS Tools , with available dynamics objects and execute sanscript function, it’s far more easier to find active window in VSTools for Dynamics GP project then in standard visual studio application.

3.Standard Visual Studio App, even can give us clue of active window by adding continuum API reference to it. Below is a code I just tried with Visual Studio 2013.

Public Class Form1

Public GPApp As Dynamics.Application
Dim s1, s2, s3, s4 As String

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

GPApp = GetObject(“”, “Dynamics.Application”)
GPApp.GetDexActiveWindow(s1, s2, s3, s4)
MsgBox(s1)
MsgBox(s2)
End Sub
End Class

Details about this of GetDexActiveWindow() method is below.The GetDexActiveWindow() method returns 4 string parameters that tell us the Form technical name,window technical name, dictionary name and window title. Shown below is an example of this code:

Dim result As Boolean
Dim mystr1 As String
Dim mystr2 As String
Dim mystr3 As String
Dim mystr4 As String

result = eEnterpriseApp.GetDexActiveWindow(mystr1, mystr2, mystr3, mystr4)

MsgBox (“Form Name = ” & mystr1)
MsgBox (“Window Technical Name = ” & mystr2)
MsgBox (“Dictionary Name = ” & mystr3)
MsgBox (“Window Title = ” & mystr4)

 

classb

out put

There are other cool ways we can use to find active window name, title. I have used one by using batch file and command prompt commands from within Dexterity to find the active window. Good programmer use windows API to do the same. 😉  And Dexterity experts also trigger the application to provide them what they are looking for. 😀

below is the source and inspiration for this post.

inspiration

Advertisements

Filed under: Dexterity Development, Dynamics GP, dynamics-gp

Dexterity Can Wait and Respond.

https://evspakistan.wordpress.com/microsoft-dexterity-can-wait-respond/

Filed under: Can i, Dexterity Development, Dynamics GP, dynamics-gp, Uncategorized, , ,

Cross Dictionary Development.

https://evspakistan.wordpress.com/cross-dictionary-development/

 

 

Filed under: Dexterity Development, Dexterity Triggers, Dynamics GP, dynamics-gp, Uncategorized

Calling Sales Document Numbers Lookup

Often developers need to open available lookup on their custom form from dynamics GP.Sales Document Number lookup is a very common and much used lookup and every dynamics technical person needs to call it in once (or more) in their lifetime. 🙂

Dynamics GP SDK provide a prototype of coding on how to open various lookup. Although it has given a much detailed list of parameters, the drawback is that we can not apply filter on the GP traditional lookup.

As with SDK prototype, desired document type can be focused but we can not make a lookup to fill only specific document type.

This leads developers to design 3rd party windows and then calling them.

SDK Prototype:

open form SOP_Document_Lookup return to ‘(L) DummySOPReturn’;
call OPEN of form SOP_Document_Lookup,
‘Sort By’, {initial sort unless overridden by starting seed of below parameters}
l_display, {documents to display}
work_or_history, {initially display WORK or HISTORY documents}
GB_locked, {lock the work/history radio group}
iSOPType, {seed value for SOP Type}
sSOPNumber, {seed value for SOP Number}
sCustomerNumber, {seed value for Customer Number}
sBatchNumber, {seed Number of Batch Number, Work Documents only}
sTRXSource, {seed Audit Trail code, History Documents only}
dDocDate, {seed Document Date}
iMasterNumber; {seed Master Number value}

In this SDK scrip calling example there are two optional parameters not used, but mentioned in parameters description which you can get detail from parameter list.

  • IN12 optional OpenedFromTrx parameter used by the SmartList product
  • IN13 optional RestrictSOPType parameter that will restrict the lookup to a specific SOP Type.

By supplying these two parameters we can filter lookup with desired sales type and can avoid designing of a whole new custom lookup form.Below is a code of calling lookup, I am just giving the idea of passing parameter and so hard-coded the values.

open form SOP_Document_Lookup return to ‘(L) FromDocNumb’;
call OPEN of form SOP_Document_Lookup,
4,
0,
WORK,
1,
2,
“”,
“”,
“”,
“”,
l_date,
0,
true,
soptype;

The last  parameter is telling that you are about to filter the lookup with the selected type on custom form. This will work find if your alternate smartlist lookup is marked, but if traditional GP lookup is marked, it will not filter the document types.

 

SOPLOOKUPFIlter

The hard thing for many developers is that they can not test the code in debug mode\test mode, as the lookup mark is in another dictionary and gives a message “Cannot access this form because the dictionary containing it is not loaded.”, so to test code functionality, developer have to create a chunk and then add a code in GP.

 

Filed under: Dexterity Development, Dynamics GP, Dynamics GP Lookups, dynamics-gp, ,

Finding Field Name and Table Name of custom table.

That’s not a good thing to copy and past. 😦

Mr. Phani  copy my this post and publish in his blog without referencing my blog post.

 

phani4dexterity

This post is specially for new comers for GP who find it difficult to know field names and table names of custom table when need to use in sql scripts for their add on application for Dynamics GP.

 

 Let take an example of Customer Maintenance. We have added a table evsTable and it’s two fields on a window.

Field 1 and Field 2.

Image

Now what you have to do is to open the window for whose field information you need, lets say we need to know in which table Field 1 will save data and what is the physical name of Field 1 to use in sql.

 Just focus on some other field and press Alt+F8 and save macro file anywhere.

Image

Now focus Field 1.

Again press Alt+F8.

 

Now go to the path where you have saved macro file and open it on notepad. You will find field…

View original post 55 more words

Filed under: Dexterity Development, My Thoughts

How to find the names of all text file in a folder in Microsoft Dexterity.

In Microsoft Dexterity we have a function Path_SelectPathname to select folder path.

According to the manual description of the function:The Path_SelectPathname() function displays a file dialog box, allowing a user to indicate the location of a file, and returns a generic pathname to that location.

But there is no way in Sanscript that we can find the contents of the folder, like to list down any specific extension files, Although it’s a common need to read text files in dexterity, so if user needs to read multiple text files inside Dexterity then he needs to select each file by using getfile() function individually, that’s not a real life situation. SO the below is a work around where user will tell the folder path and system will read all the text files of the folder. Not coding a whole scenario, just the key part of reading files names from folder.

For this particular situation we will use VBScript and Batch file, my favorite command line commands. :)I am using Sanscript function Dict_GetPathname(PATH_DATAFOLDER) to create batch file there, also vbs file will be copied there, So this could be changed according to your choice of option for saving vbs and batch files. More details of the function will be read from Dexterity Manuals. In debug mood it means you have to copy your vbs file in the folder where your dictionary is.

Open a notepad and past following line, replace the path “E:\New Working\Almas gp2010\” with your Dictionary folder path and save as listfiles.vbs

Set objShell = WScript.CreateObject(“WScript.Shell”)
objShell.Run(“””E:\New Working\Almas gp2010\command.bat”””), 0, True

open your dexterity window and copy below code in folder path select button.This will create a text file having names of all the text files inside selected folder, which then can be read through TextFile_ReadLine() function with a while loop .There should be other checks added in code like if user not selects folder path then abort script  or etc, add them according to your needs. 🙂

local integer l_File_ID;
local string com,l_Path,l_listFile,b_path,path;
local boolean result;

result = Path_SelectPathname(l_Path);
if result = true then
    FilePath of window ies_selectfolder of form ies_selectfolder = Path_MakeNative(l_Path);
end if;
path=FilePath of window ies_selectfolder of form ies_selectfolder;
b_path=Dict_GetPathname(PATH_DATAFOLDER);
b_path=Path_MakeNative(b_path);
l_File_ID=TextFile_Open(b_path+”command.bat”, 0, 2);
TextFile_WriteLine(l_File_ID, “E:”);
TextFile_WriteLine(l_File_ID, “dir /s/b “””+path+”*.txt””>”+””””+b_path+”text.txt”+””””);
TextFile_Close(l_File_ID);
run application “”,b_path+”listfiles.vbs”;

Filed under: Dexterity Development, dynamics-gp, , , , , ,

When In Dexterity, do as dexterity developer should do.

I have notice that people usually use SQL statements for doing task which have an equivalent and easy way of doing in dexterity. while browsing through Dynamics community found this particular post. The person who posted the issue is doing the same, using SQL to delete the records from Dexterity form. The disadvantages I found with this method are.

  1. Extra line of code.
  2. Possible issue of SQL_Connect.
  3. Hidden SQL script errors which could only confirm only if we first compile them first on Query Analyzer and then use in our code.
  4. Limitation of text field length which can not be greater than 32,767.
  5. Two many concatenation for larger queries.
  6. Possibilities of error increases, dexterity syntax, SQL syntax errors, Tables and fields reference error and difficult to debug.

As compare to SQL_Execute, dexterity remove from table is best, simple and sweet.

release table table1;
‘Item Number’ of table table1=’Item Number’;
change table table1;
if err()=OKAY then
remove table table1;
end if;

GP will take care of database connectivity and getting the right record to delete from right table. I always avoid using SQL_Execute until unless it is not done by dexterity provided syntax for any kind of table operations.

Filed under: Dexterity Development, ,

Chunk file converted into dictionary but showing no custom forms in GP.

This happened today why my junior colleague was deploying customization on client machine, His chunk file was prompting to add code, code gets included but when log-in to GP and tried to access custom forms find nothing. He thought issue is with chunk file and recreated chunk file twice but no luck.
He asked me to help him out. So I check GP folder,custom dictionary was there, then I checked dynamics.set file but product information was not there and which makes me to look GP folder properties and what I found is that the GP folder was marked read only so Just unmarked the read only option and un-chunk the file again will solve the problem. 🙂

Filed under: Dexterity Development, Dynamics GP, dynamics-gp, Uncategorized, , , ,

If you are using ‘STR5’ datatype of Dexterity.

then please note, it actually a numeric only field. 🙂

Better create your own string 5 data type.Image

Filed under: Dexterity Development, Dynamics GP, dynamics-gp, Uncategorized, ,

How to find, due to which Dynamics GP User sql stored procedure is calling?

Often we need to pass user id and intercompany id to sql stored procedure to do some data selection from custom tables or to maintain the log regarding user activity. This happens with us with one custom window of Dynamics GP, in the beginning our stored procedure didn’t need user id and intercompany id parameters and was working fine but with the client requirement changes at some point we needed to pass these two parameters, adding parameters means creating chunk and deployment to all machines, which was not possible as users were connected and updated was necessary as it was hindering there routine work.

We can get intercompany id easily by using   select dB_name() but we also needed to find the Dynamics GP user who is calling the stored procedure. To find that user we use this function inside our stored procedure and in this way  avoid updating chunk.

SUSER_SNAME()

This will returned the login dynamics gp user id when stored procedure will be called from GP.

Filed under: Dexterity Development, SQL,

Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Enter your email address to follow this blog and receive notifications of new posts by email.

almas

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Blog Stats

  • 8,647 hits

RSS dynamics-gp

  • VSTools and database triggers.
    In SanScript coding we have database triggers, Below is a detail of what database triggers are as explained in dexterity manuals. Database triggers Database triggers are activated by successful table operations, such as a record begin read, saved, or deleted. The procedure that runs in response to a database trigger has access to the same […]
    Almas
  • Getting the current active window in Dexterity.
    Using dexterity there is not a direct way of getting current active window information, but with set of available GP functions and triggers can make this task happen. Below I am sharing a trigger and function which can tell the active window name. Below code needs to be changed according to the needs of developer, […]
    Almas
  • Hints and Tips… On going Post
    This is on going post and points will be added from time to time. 🙂 .. with Field Level Security we can not restrict document access on Sales transaction entry Window. Means we can not make user to choose only ‘Invoices’ in SOP Type drop down. .. we can not add custom table in table […]
    Almas
  • Reversing the sort order of Receivable Transaction Inquiry – Customer by Document Date
    Last few months we got more request on changing sort orders of Inquiry windows and lookups and to cover them all in a one place I have been working on a small project which will provide a simple sorting without much effort. In Dynamics Community there was a post having similar situation, I have already […]
    Almas
  • Getting the current open window in .net GP Add In
    There are many ways of getting information of active window in GP, but it changes according to the developing tool we are working on. 1.Dexterity.(the best tool 🙂
    Almas
  • Not all RW_Function are meant for reports.
    There are lots of RW functions available in a report writer Calculated Field Definition window and almost all of them are so handy while working on report writer, but it is a matter of fact that some of them are not actually meant for report writer. Usually RW functions are associated with report writer and […]
    Almas
  • Dexterity Can Wait and Respond.
    https://evspakistan.wordpress.com/microsoft-dexterity-can-wait-respond/Filed under: Can i, Dexterity Development, Dynamics GP, dynamics-gp, Uncategorized Tagged: Delay, dexterity, Wait
    Almas
  • Cross Dictionary Development.
    https://evspakistan.wordpress.com/cross-dictionary-development/    Filed under: Dexterity Development, Dexterity Triggers, Dynamics GP, dynamics-gp, Uncategorized
    Almas
  • Calling Sales Document Numbers Lookup
    Often developers need to open available lookup on their custom form from dynamics GP.Sales Document Number lookup is a very common and much used lookup and every dynamics technical person needs to call it in once (or more) in their lifetime. 🙂 Dynamics GP SDK provide a prototype of coding on how to open various […]
    Almas
  • This datatype name is already in use.
    This datatype name is already in use.
    Almas
Coding Notes

Code, News, Tech & Stuff

Dynamics GP Builders & Reporting

How to use MS Dynamics SmartList Builder, Excel Report Builder and other Reporting tools to get the data and analysis you need.

%d bloggers like this: