Wednesday, October 30, 2013

Integration Manager 2013 - Unimplemented cast from Btype 'BROWSETYPE_UNKNOWN'

This is a bug with Integration manager 2013.
You transactions integrated just fine.
If you ran it multiple times, you will need to void the additional transactions.

Increase the number of errors allowed ,and run your integration once.

Dynamics GP Report Writer Tricks

All calculated string fields can show up to 80 characters. However, report writer truncates what is displayed based on the size of the text box, and the font size being used. To get the full 80 characters,drop the font size to 6, and expand the entire field all the way out.

This will allow it to export correctly for your word form template.

Dynamics GP - Default Smartlist Security

There is no default smartlist security.
All users have access to all smartlists by default.

To limit access, create a task and a role.
In the role, select Smartlist, smartlist objects, smartlist objects, and select the specific smartlists to grant access.

Assign this role to a user.

This will override the default "all access"

Tuesday, October 29, 2013

Dynamics GP - Report Writer Description fields not showing all characters on reports.

Notes:
Report Writer WILL wrap text if you stretch the field downward, but the default field only shows 50 characters.
Report Writer WILL NOT wrap text if there are no spaces in the data, even if you stretch the field downward.

Issue:
GP Item Description can take 100 characters.
Report Writer Fields are limited to 50 Characters (this is 80 in newer version of gp)
Report Writer Calculated Fields are limited to 40 Characters  (this is 80 in newer versions of gp)

This applies to a number of different fields.

Solution 1: Report Writer functions
Create Multiple calculated fields to chop the description into 40,80,100, and pull all three fields onto the report.
This will cause hard cuts, and may cut a word in the middle

Use the RW_Substring function under user-defined functions

  • The format is 
  • Functions>User-defined>System
  • RW_Substring add
  • Item Description add
  • start position constant add
  • substring length constant add
Do not remove any characters, do not add any other fields or characters
So for example, if i wanted to chop the item description start at character 81, and i wanted my string to be 20 characters long, it would look like
RW_Substring Item Description 81 20
in the report writer editor

For the Check Formats, you can split the PM10300.STRGA255 to replace the STRGA255 and STRGB255 fields on the report. (does not work, cuts cents badly)

Create two calculated string fields with formulas that will look like

  • Function Script(RW_Substring PM_Payment_Work.STRGA255 1 60)
  • Function Script(RW_Substring PM_Payment_Work.STRGA255 61 60)

Or use the Purchasing>RW_Splitwordamt function

  • Create 3 calculated fields
  • Function Script(RW_Splitwordamt PM_Payment_Work.STRGA255 PM_Payment_Work.STRGB255 75 1)
  • Function Script(RW_Splitwordamt PM_Payment_Work.STRGA255 PM_Payment_Work.STRGB255 75 2)
  • Function Script(RW_Splitwordamt PM_Payment_Work.STRGA255 PM_Payment_Work.STRGB255 75 3)
Or use the RW_ConvertToWordsAndNumbersParse (use this method)
https://blogs.msdn.microsoft.com/developingfordynamicsgp/2010/05/23/announcing-report-writer-function-rw_converttowordsandnumbersparse/


  • FUNCTION_SCRIPT(RW_ConvertToWordsAndNumbersParse  cyPrintTotal   (c) Currency ID  0   80   1)
  • FUNCTION_SCRIPT(RW_ConvertToWordsAndNumbersParse  cyPrintTotal   (c) Currency ID  0   80   2)
  • FUNCTION_SCRIPT(RW_ConvertToWordsAndNumbersParse  cyPrintTotal   (c) Currency ID  0   80   3)


Related links:
http://support.microsoft.com/kb/950780


Solution 2: Report Writer with VBA
Add VB code to connect directly to table, get the full description, then cut the fields  up based on spaces between the words.

I would just pass this to a label field instead to prevent the need to cut based on spaces in the words, but there is also a limit on the label field.

Related links:
http://blogs.msdn.com/b/developingfordynamicsgp/archive/2009/05/25/showing-the-full-item-description-on-invoices-example.aspx


ADO Sample
-----------------------------------------------------
Option Explicit
Dim objRec
 Dim objConn
 Dim cmdString
'Dim cn As New ADODB.Connection



Private Sub Report_BeforeBody(SuppressBand As Boolean)
End Sub
Private Sub report_start()
 Set objRec = CreateObject("ADODB.Recordset")
 Set objConn = CreateObject("ADODB.Connection")
 objConn.ConnectionString = "Provider=SQLOLEDB;Data Source=DYNGP;Initial Catalog=TWO;User Id=sa;Password="

 'cn = UserInfoGet.CreateADOConnection
 ' cn.CursorLocation = 3
 '  cn.DefaultDatabase = UserInfoGet.IntercompanyID
 ' cn.Open
 
 objConn.Open
End Sub
Private Sub Report_BeforeAH(ByVal Level As Integer, SuppressBand As Boolean)

 cmdString = "select Source_Document_Number from pop10110 where PONumber = '" + RTrim(PONumber) + "' and itemnmbr = '" + RTrim(ItemNumber) + "'"
 Set objRec = objConn.Execute(cmdString)
 If objRec.EOF = True Then
 xReqNo = ""
 Else
 xReqNo.Value = objRec!Source_Document_Number
 End If
End Sub

Private Sub report_end()
 objConn.Close
End Sub

Ensure that you add all fields you need to VB
Ensure you run GP as administrator or the VB will not save
Call this in the body to execute for each record
ManufacturingOrderReceiptEn.CurrencyM105 is an empty calculated field
You must put the calculated field in the BODY or the appropriate section where the VB code is running

Sunday, October 27, 2013

SQL - Scan all tables and fields for a text string

Original Post
http://stackoverflow.com/questions/591853/search-for-a-string-in-an-all-the-tables-rows-and-columns-of-a-sqll-server-db


--------------------------------------------------------------------------------------

DECLARE
    @search_string  VARCHAR(100),
    @table_name     SYSNAME,
    @table_id       INT,
    @column_name    SYSNAME,
    @sql_string     VARCHAR(2000)

SET @search_string = 'pal'

DECLARE tables_cur CURSOR FOR SELECT name, object_id FROM sys.objects WHERE type = 'U'

OPEN tables_cur

FETCH NEXT FROM tables_cur INTO @table_name, @table_id

WHILE (@@FETCH_STATUS = 0)
BEGIN
    DECLARE columns_cur CURSOR FOR SELECT name FROM sys.columns WHERE object_id = @table_id AND system_type_id IN (167, 175, 231, 239)

    OPEN columns_cur

    FETCH NEXT FROM columns_cur INTO @column_name
    WHILE (@@FETCH_STATUS = 0)
    BEGIN
        SET @sql_string = 'IF EXISTS (SELECT * FROM [' + @table_name + '] WHERE [' + @column_name + '] LIKE ''%' + @search_string + '%'') PRINT ''' + @table_name + ', ' + @column_name + ''''
--print @sql_string
        EXECUTE(@sql_string)

        FETCH NEXT FROM columns_cur INTO @column_name
    END

    CLOSE columns_cur

    DEALLOCATE columns_cur

    FETCH NEXT FROM tables_cur INTO @table_name, @table_id
END

CLOSE tables_cur

DEALLOCATE tables_cur

Saturday, October 26, 2013

Dynamics GP - Install smartconnect 2013

Pre-Requisites
You may need to install the following on the client depending on the types of integrations you intend to run


Confirm the Smartconnect User Password if you have already setup smartconnect previously.

Install smartconnect 2013
Run smartconnect, setup gp connector
Run gp, include code, update resource cache
Run smartconnect, run maintenance


Dynamics GP - How to upgrade a forms / Reports dictionary using Dynamics GP Utilities

Copy Old GP Folder
Install New GP
Copy Old dictionary to New GP Data folder
Run GP Utilities
Select Upgrade forms/Reports dictionary
Select OLD Dynamics.set
Select Reports.dic you copied into NEW GP
Process