Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • Isomorphic
    replied
    We've augmented the appropriate docs back to SGWT 6.1p/SC 11.1p to include our above guidance for doing a remove without a primary key. It will be in the nightly builds dated 2019-06-26.

    Leave a comment:


  • Blama
    replied
    Hi Isomorphic,

    I agree on the "unwanted big delete" and our current or your workaround is fine for me. Could you add this to the DSRequest.setCriteria() docs?
    I also agree on custom in favor of fetch and will change that. This implies that the very setCriteria() function is also valid on OP_CUSTOM requests, so the docs should also mention this.

    oldValues most likely won't work for me, as the Criteria currently sent is AdvancedCriteria.

    Best regards & thanks for the fast answer,
    Blama

    Leave a comment:


  • Isomorphic
    replied
    We would recommend doing this via a custom operation, which is probably a clearer approach. You can also do it as a remove, but just use dsRequest.oldValues as the source for whatever criteria values you need - this covers everything except AdvancedCriteria.

    We are rather reluctant to directly support a criteria-driven remove from the client, especially one that takes AdvancedCriteria, as this is a very dangerous use case where it would be easy to wipe an entire database, or leave a security hole / bug that would allow users to do so.

    Leave a comment:


  • 12.0p: Support for remove/update DSRequests from client with criteria (instead of PK) and best practice for doing so now?

    Hi Isomorphic,

    it seems that as of today, for big clientside delete requests, you have to fake something like this, where you abuse a FETCH operationBinding for the sole purpose of transferring criteria for the REMOVE request to the server.
    I would be good if there was support to send a REMOVE request with criteria instead of with PK values / record.

    At least, if this is the best practice for the use case, this should be mentioned somewhere. Is it the best practice?

    Code:
    if (buttonTitle.equals(I18nEdited.deleteAll())) {
        resellerSalesareaDS.removeData(new Record(), null, new DSRequest() {
            {
                setOperationId(OperationIdEnum.T_RESELLER_SALESAREA__REMOVEALL.getValue());
            }
        });
    } else if (buttonTitle.equals(I18nEdited.deleteShown())) {
        resellerSalesareaDS.fetchData(salesareaGrid.getFilterEditorCriteriaAsAdvancedCriteria(), null, new DSRequest() { //is FETCH request in order to transport criteria to the server, does a REMOVE on the server instead with this criteria.
            {
                setOperationId(OperationIdEnum.T_RESELLER_SALESAREA__REMOVESHOWN.getValue());
            }
        });
        ;
    }
    Current docs excerpt for the DSRequest.setCriteria() that I'd like to use inside of DataSource.removeData()
    Code:
    This method applies to "fetch" requests only; for update or delete operations pass a Record to setData() which contains primaryKey values as Record attributes.
    Best regards
    Blama
Working...
X