Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Deleting Record from Memory Array

(0) ShareShare
ReportReport
Posted on by

I'm trying to compare records in a memory array for a grid to a specific criteria.  If they don't match, I use the MDelete function to remove the record from the memory  array.  When I have looped through all the records, I use MFirst to move to the first record, and then MDisplay to refresh the contents of the memory array on the grid.  However, while it does correctly identify the records that need to be removed, and does not give an error when using the MDelete function, when I use the MDisplay to show the records, all the records are still present, including the ones that should have been removed.  Here is the code I"m using:

Private Sub cmdRefresh_Click()
mem_Detail = GetGridHandle("SafGrid1")
If Trim(CreditSite) <> "" Then
Dim User8 As String
Dim OrdNbr As String
  serr1 = MFirst(mem_Detail, MemMaintFlg)
      
     While (serr1 = 0)
       
        'check value of User8
        Call GetBufferValue("bsoheader.User8", User8)
       If Trim(User8) = Trim(CreditSite) Then
       'go on to the next record      
               serr1 = MNext(mem_Detail, MemMaintFlg)
        Else
              'delete this record from memory array

              RecFetch = MDelete(mem_Detail, MemMaintFlg)
        End If

      Wend
      serr1 = MFirst(mem_Detail, MemMaintFlg)

      Call MDisplay(mem_Detail)
      
 End If
 
End Sub

Any thoughts or suggestions on what I'm doing wrong?  Thanks in advance.

*This post is locked for comments

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... 293,272 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,931 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans