locked
How to Delete a Record with a image in it RRS feed

  • Question

  • Hello

    I try to delete a single screen record with an image in it but no success because of the image. (without the image it works fine!

    What is wrong, do i have to delete first the image itself and then the record, or how does it work? thanks for your help!

    code:

    myapp.ViewCustomer.DelDS_execute = function (screen) {

    screen.getCustomer(). then(function (Customer) {

    Customer.deleteEntity();

    msls.application.navigateBack();

    });

    };

    after the confirmation to delete error comes up! "related recors feferencing"

    Wednesday, July 6, 2016 12:59 PM

Answers

  • Well,

    Just to remove picture itself, you set it to null (like entity.setPicture(null)).. 
    Perhaps you could check Michael's HTML picture manager here, he is using wcf service but there is much javascript code also.. hth..

    Kivito


    Nobody expects the Spanish Inquisition! (M.P.F.C.)

    Friday, July 8, 2016 2:27 PM
  • hi Kivito

    now it works. many thanks - merci

    marcel

    • Marked as answer by marcel_W Tuesday, July 12, 2016 8:13 AM
    Tuesday, July 12, 2016 8:13 AM

All replies

  • Hi!

    At first it seems that picture is from another table and that relationship is defined as "Restricted", so yes, you should first delete picture (or record if it comes from another table) and then the record itself, or set-up different relationship like cascade delete so by deleting master you'll delete child records also.. but without more information it is hard to say.. hth..

    Kivito


    Nobody expects the Spanish Inquisition! (M.P.F.C.)

    Wednesday, July 6, 2016 1:24 PM
  • Hello Kivito

    Thanks for our info. The Picture is in the same table (no other tables or relations).

    And the Picture itself, how do I delete a Picture alone? Just by press DEL (like text) does not work, what is the code therefore?

    many thanks for help,

    marcel

    • Marked as answer by marcel_W Thursday, July 7, 2016 7:33 AM
    • Unmarked as answer by marcel_W Thursday, July 7, 2016 7:33 AM
    Thursday, July 7, 2016 7:32 AM
  • Hi!

    Hm, that's strange, but perhaps try with myapp.commitChanges instead of msls.application.navigate back.. hth..

    Kivito


    Nobody expects the Spanish Inquisition! (M.P.F.C.)

    Friday, July 8, 2016 10:15 AM
  • hi,

    unhappily NO success!

    how do i delete a picture in a record (in edit modus)?

    and how is the code for deleting only a pictuer in a recordset, i tried with...

    screen.customer.getFoto().then (function (Foto) {

    Foto.deleteEntity();

    myapp.commitChanges;

    thanks for you feedback

    marcel

    Friday, July 8, 2016 2:03 PM
  • Well,

    Just to remove picture itself, you set it to null (like entity.setPicture(null)).. 
    Perhaps you could check Michael's HTML picture manager here, he is using wcf service but there is much javascript code also.. hth..

    Kivito


    Nobody expects the Spanish Inquisition! (M.P.F.C.)

    Friday, July 8, 2016 2:27 PM
  • hi Kivito

    now it works. many thanks - merci

    marcel

    • Marked as answer by marcel_W Tuesday, July 12, 2016 8:13 AM
    Tuesday, July 12, 2016 8:13 AM