5 Replies Latest reply on Mar 26, 2008 2:35 PM by (Laurence_Lewis)

    How does the delete record wizard work?

    (Laurence_Lewis)
      Hi,

      I have been trying to work out how the "Delete Record Wizard" Works.

      I tried the help for the function but that does not explain a lot.

      Can someone give me an idea how to set this up.

      The end result I want is to delete only some entried in a table row not the entire row. Something like

      $query_dele = sprintf("SELECT * FROM members WHERE id_user = members.Phone", GetSQLValueString($colname_dele, "int"));

      Thanks

      Laurence
        • 1. Re: How does the delete record wizard work?
          Level 1
          You need to UPDATE a row in a database and set the specific fields to blank. A SQL DELETE operation only deletes rows, it does not change their values.
          • 2. Re: How does the delete record wizard work?
            (Laurence_Lewis) Level 1
            Hi Sean

            Thanks, sometime the obvious seems distant, when ones staring at a block of seemingly logical code :-)

            Cheers

            Laurence
            • 3. Re: How does the delete record wizard work?
              (Laurence_Lewis) Level 1
              Hi Sean

              What I am trying to achieve is I have a check box 1/0 called processed.

              When ticked it shows the persons request has been processed.

              When processed is set to "1" (Checked) i want to delete the credit card details from the row.

              //Delete credit card number on set processed

              if ($row_rsEvents['Processed'] = '1')
              mysql_query("UPDATE Events SET cardNumber = '-' WHERE id_event=%s");


              //end

              table row is

              <td><input <?php if (!(strcmp(KT_escapeAttribute($row_rsEvents['Processed']),"1"))) {echo "checked";} ?> type="checkbox" name="Processed" id="Processed" value="1" />
              <?php echo $tNGs->displayFieldError("Events", "Processed"); ?> </td>

              Gulp I am still getting it wrong

              Any tips appreciated

              laurence
              • 4. Re: How does the delete record wizard work?
                Level 1
                Laurence,

                I realize that this is a bit late. I would do a Custom Trigger set to execute AFTER your Update transaction(This can be set at the advanced tab of the Custom Trigger Wizard). I am assuming you are using an ADDT Update Record transaction to let the user check the box once an order has been processed. The Custom Trigger would look something like this:

                function Trigger_Custom(&$tNG) {

                $processed = $tNG->getColumnValue("Processed");
                $primaryKey = $tNG->getPrimaryKeyValue();

                if($processed == 1) {
                $query = "UPDATE Events SET cardNumber = '-' WHERE id_event = $primaryKey";
                $tNG->connection->Execute($query) or die($tNG->connection->ErrorMsg());
                }

                }

                That should be all you need to do.

                Hope this helps.

                Shane
                • 5. Re: How does the delete record wizard work?
                  (Laurence_Lewis) Level 1
                  Hi Shane

                  Good ideas are never too late, thanks.

                  I ended up adding a button link to the list page called "Delete Card Details" The button appears only if "Processed" is set to "1" and Credit Card is choosen as the payment type.. When I thought about it it seemed a better to give the user the manual choice to delete the card number from the system. Once the 'Card Number" field is empty the list button dissapears and Card Deleted displays.

                  I have copied your code example as I will be using it in other areas so thanks for contributing to this post.

                  Cheers

                  Laurence