locked
Discard changes on screen level RRS feed

  • Question

  • Hello,

    I've a combined search, add new and edit screen with an entity and related entities.

    What I want to do is discarding all modification on the screen by a "discard modifications" button which should include the main entity (e.g. customer) and all it's related entities (e.g. business contacts). For the main entity it's no problem to do something like Me.CustomerProperty.Details.DiscardChanges(), but this line of code discards just the customer modifications. The modifications done within the related business contacts still exist. This is also indicated by the - *  on the screen tab header which also still exists. The screen itself has no DiscardChanges() as long as I can see.

    Is there a solution to discard all modifications on the screen or do I have to reload the customer with it's related entities.

    Thanks for your help

    Uwe

    Monday, January 9, 2012 9:52 AM

Answers

  • Hi Uwe,

    It looks like you are looking for the DiscardChanges method that resides at the DataService/DataSource level.  This can be accessed via Me.DataWorkspace.ApplicationData.Details.DiscardChanges(), where ApplicationData is the name of the data source that contains the data diplayed on the screen. 

    Note:  If your screen displays editable data from more that one data source, you would have to make multiple calls to DiscardChanges - one for each editable data source.

    HTH

    • Marked as answer by Uwe Helmut Monday, January 9, 2012 4:29 PM
    Monday, January 9, 2012 3:12 PM

All replies

  • you should override the PersistChangeSet() method in your data service 

     


    If (myAnswer == valuable ) {return Vote +1;} Else { "sorry but am trying to help you";} Jamil MilheM
    • Proposed as answer by Jamil MilheM Monday, January 9, 2012 3:10 PM
    Monday, January 9, 2012 3:10 PM
  • Hi Uwe,

    It looks like you are looking for the DiscardChanges method that resides at the DataService/DataSource level.  This can be accessed via Me.DataWorkspace.ApplicationData.Details.DiscardChanges(), where ApplicationData is the name of the data source that contains the data diplayed on the screen. 

    Note:  If your screen displays editable data from more that one data source, you would have to make multiple calls to DiscardChanges - one for each editable data source.

    HTH

    • Marked as answer by Uwe Helmut Monday, January 9, 2012 4:29 PM
    Monday, January 9, 2012 3:12 PM
  • Hello snomis

    you made my day.I didn't see the wood for the trees. I've alreay tried DiscardChanges at the DataService level, but I didn't realize that I've used the wrong data source before I read your answer.

    Cheers

    Uwe

     

    Monday, January 9, 2012 4:29 PM