Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

DetailSetupExtend in Customizatiom Manager

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
    Barry Flynn 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
    Nayan Mansinha 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
    Barry Flynn 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
    Nayan Mansinha 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
    Nayan Mansinha 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
    Barry Flynn 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans