EMPTY TEMP-TABLE - Forum - Mobile - Progress Community

EMPTY TEMP-TABLE

 Forum

EMPTY TEMP-TABLE

  • Is there a way to empty the TT on the client side? Something similar to EMPTY TEMP-TABLE ttCustomer.

  • What's your exact problem, can't you use EMPTY TEMP-TABLE ttCustomer? Maybe you can use the method?

    EMPTY-TEMP-TABLE( ) method

    Deletes all records from a temp-table associated with a buffer object.

    When you empty a temp-table that is defined as UNDO within a transaction, the ABL Virtual Machine (AVM) deletes the records individually. This is less efficient than emptying the temp-table outside the transaction, where the AVM deletes all records in the temp-table as a unit.

    Return type:  LOGICAL

    Applies to:  Buffer object handle

  • Ah, sorry, group = mobile. Don't know about that.

  • I should have specified on the mobile device.

    Thanks

  • Roger,

    You can loop through the records and remove them as follows:

     // remove cart options, if any exist
    VehicleOrderService_ShoppingCartService_JSDO.jsdo
      .eShoppingCartOption
      .foreach(function(cartOption) {
        // console.log(cartOption);
        cartOption.remove();
    });


  • Thanks Peter.

  • Hello Roger,

    You could use the addRecords() method by adding no records using the EMPTY mode.

    Examples:

    - jsdo.eCustomer.addRecords({}, progress.data.JSDO.MODE_EMPTY)

    - jsdo.addRecords({}, progress.data.JSDO.MODE_EMPTY)

    The addRecords() method is valid at the jsdo instance if there is only one temp-table.

    The difference between this approach and using the remove() method is that remove() marks the record to be deleted in the JSDO and if you call saveChanges() a DELETE operation would be sent to the backend.

    I hope this helps.