How to replace the exiting list and fill the new list value

 /// <summary>

/// Converts the <c>orderedRecords</c> map to a list.

/// </summary>

/// <returns>The map converted to a list.</returns>

public List convertMapToList()

{

    InventTrans     inventTransMarked;

    InventTrans     inventTransReceipt;

    InventTransOrigin   inventTransOriginOfProdTable;

    ProdTable           prodtable;

   

    List resultNew = new List(Types::Record);

    List result = new List(Types::Record);

   

    RefRecId  inventtransorigirecid;


    result =  next convertMapToList();


    if(SFCProductionProgressTransService_POR::cachedToIdentifyForSorting_POR(false))

    {

        inventtransorigirecid = parameters.movement.inventTransOriginId();

    

        while select inventTransMarked

               // group by  prodtAble.DlvDate, inventTransMarked.InventTransOrigin

             order by  inventTransMarked.InventTransOrigin ,prodtable.DlvDate

            where inventTransMarked.InventTransOrigin == inventtransorigirecid

                //&& inventTransMarked.StatusIssue      == StatusIssue::ReservOrdered

                //|| inventTransMarked.StatusIssue      == StatusIssue::ReservPhysical

                //|| inventTransMarked.StatusIssue      == StatusIssue::OnOrder

                 exists join inventTransOriginOfProdTable

                      where inventTransOriginOfProdTable.RecId == inventTransMarked.MarkingRefInventTransOrigin

                            && inventTransOriginOfProdTable.ReferenceCategory == InventTransType::ProdLine

                  exists join prodtable

                        where prodtable.ProdId == inventTransOriginOfProdTable.ReferenceId

        

                if(inventTransMarked.RecId && this.existRecordInList_POR(result, inventTransMarked.RecId))

                {

                    resultNew.addEnd(inventTransMarked);

                }


            if (resultNew.elements() == result.elements())

            {

                // shouldn't happen unless marking is single sided (issue marked on receipt doesn't appear to be marked).

                result = null;


                resultNew.appendList(resultNew);


                result = resultNew;

            }

        }


    return result;


}


=====================================================================


/// <summary>

/// Checks if there is a Recid exists in the standard List object.

/// </summary>

/// <returns>True if there is a record exiSts in List object; otherwise, false</returns>

boolean existRecordInList_POR(List _standardResult, RecId _inventTransRecID)

{

    

    ListIterator iter = new ListIterator(_standardResult);

    inventtrans      listInventTrans;

    boolean         recordFound = false;


    while (iter.more())

    {

        listInventTrans = iter.value();

 

        if (listInventTrans.RecId == _inventTransRecID) // check value

        {

            recordFound = true;

            break;

        }

        else

        {

            iter.next();

        }

    }


    return recordFound;

}


===================================================================

Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++