Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

DetailSetupExtend in Customizatiom Manager

(0) ShareShare
ReportReport
Posted on by 1,245

Hello Everyone

I'm trying to add a new "in memory" custom field that does not exists in the Insert Object Wizard field list to a existing spread control (grid) of Purchase Orders (04.250.00) screen. This field will be read-only and will display Account.Acct_cat value for the selected purorddet.puracct.

 I believe DetailSetupExtend which is part of SDK lets one do something of this nature. 

Any help is much appreciated.

TIA

Nayan

*This post is locked for comments

  • Barry Flynn Profile Picture
    3,090 on at
    Re: DetailSetupExtend in Customizatiom Manager

    << BTW, didn't we connect during Convergence? Was it you or someone else?

    I wasn't at Convergence.

    Barry

  • Nayan Mansinha Profile Picture
    1,245 on at
    Re: DetailSetupExtend in Customizatiom Manager

    yes.  I did change it to GetGridHandle.  Thank you so much for your help.  BTW, didn't we connect during Convergence? Was it you or someone else?

    thanks again

  • Barry Flynn Profile Picture
    3,090 on at
    Re: DetailSetupExtend in Customizatiom Manager

    Nayan

    I think you have a problem in your Form Display code.

    The code you posted is as follows

    << Private Sub Form1_Display()

    <<    MH_Grid = VBA_MOpen(bAccount, LenB(bAccount), Null, 0, Null, 0, Null, 0)

    <<    serr1 = VBA_Mextend(MH_Grid, bAccount, LenB(bAccount))

    << End Sub

    That code does NOT attach the Account table to the grid.

    Instead, it creates a new array containing the table, then attaches the table to that new array for a second time.

    You don't need the VBA_Open. That call creates a new array, and you don't need one of those.

    Instead, use GetGridHandle to find the handle of the array that is attached to the existing grid.

    Then your VBA_MExtend uses THAT handle, so that it attaches the Account table to the existing grid.

    Hope that helps...

    Barry

  • Nayan Mansinha Profile Picture
    1,245 on at
    Re: DetailSetupExtend in Customizatiom Manager

    Never mind.  Our var pointed out the obvious mistake of mine.  the name of the table in the VBA_SetAddr's first arg was not correct.  it should be bAccount.

    thanks again for your help.

  • Nayan Mansinha Profile Picture
    1,245 on at
    Re: DetailSetupExtend in Customizatiom Manager

    I followed the instructions you gave but the Account table is not showing up in Insert Object Wizard.  Seems like I'm missing something.  below is the code I added. Please let me know if you see something odd in there.  thanks in advance.

    Private Sub Form1_Load()

       Call VBA_SetAddr("Account", bAccount, nAccount, LenB(bAccount))

       Call SqlCursorEx(CSR_Account, NOLEVEL, "CSR_Account", "Account", "")

    End Sub

    Private Sub Form1_Display()

       MH_Grid = VBA_MOpen(bAccount, LenB(bAccount), Null, 0, Null, 0, Null, 0)

       serr1 = VBA_Mextend(MH_Grid, bAccount, LenB(bAccount))

    End Sub

  • Barry Flynn Profile Picture
    3,090 on at
    Re: DetailSetupExtend in Customizatiom Manager

    Nayan

    First - export the customization to a cst file, and save that file. Then - if it all goes wrong, you can import that cst file and get back to where you are now.

    << will display Account.Acct_cat value for the selected purorddet.puracct.

    My suggestion is:-

    - Include the Account table's .dh filr in the customization

    - In Form Load, do a SetAddr for that table

    - And a SQLCursorEx

    - In Form Display, do a vba_mExtend

    Unless I've forgotten something, at that point, if you save the customization, and reload the screen, the Insert Object wizard should offer you the Account table.

    You will also need to write some code (probably using SQLFetch1) to Fetch the right Account record at various times - including when the grid gets loaded or updated.

    Hope that gives you a start...

    Barry

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,886 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,768 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans