Quantcast
Channel: Microsoft Dynamics SL Forum - Recent Threads
Viewing all articles
Browse latest Browse all 2378

Custom Code to Iterate Through Sub-Records of Buffer Memory

$
0
0

We are looking to do some advanced validation in the receipts screens which requires us to iterate through the inventory items on the receipt screen and subsequently iterate through the lot records on the associated Lot/Serial screen. I can get the code to run through the inventory item lines, but when I pull the data for the Lot/Serial records, it is only pulling the most recent line item.

For example:

  1. Invt Item A
    1. Lot A123
    2. Lot A456
  2. Invt Item B
    1. Lot B123
    2. Lot B456
    3. Lot B789

Although I can iterate through and get 2 records out of the main grid handle (A/B), each iteration of the lot/serial records only provides me the lots associated with the last inventory item I opened the Lot/Serial screen on. If I were simply concatenating a message box it would look something like the following if I had opened inventory item B Lot/Serial last.

Not sure what I'm missing on how to move the memory buffer for the sub-screen.

MESSAGE BOX

Inventory Item A, Lot B123, Lot B456, Lot B789;

Inventory Item B, Lot B123, Lot B456, Lot B789;

    GridHandle = GetGridHandle("Spread1")
    If GridHandle <> 0 Then
        Row = MGetRowNum(GridHandle)
    End If
    serr1 = MFirst(GridHandle, MaintFlag)
    While serr1 = 0
        Call GetBufferValue("bpotran.InvtID", strInvtID)
        strMsg = strMsg & "Inventory Item " & strInvtID
        LS_GridHandle = GetGridHandle("LS_Spread2")
        If LS_GridHandle <> 0 Then
            Row2 = MGetRowNum(LS_GridHandle)
        End If
        serr2 = MFirst(LS_GridHandle, MaintFlag)
        While serr2 = 0
            Call GetBufferValue("blotsert.LotSerNbr", theLot)
            strMsg = strMsg & ", Lot " & theLot"
            serr2 = MNext(LS_GridHandle, MaintFlag)
        Wend
        strMsg = strMsg & ";" & chr(10)
        serr1 = MNext(GridHandle, MaintFlag)
    Wend



Viewing all articles
Browse latest Browse all 2378

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>