1 Reply Latest reply on Dec 10, 2008 8:21 AM by dizmarkie

    move up/down column not working fully, thought i had it but i was wrong

      Ok, thought I had this working but it is not fully.
      in the dynamic list wizard it asks what field you would like to use for move/up down column. I have a field as an integer type and it is called "sort"

      when i add a new record the field defaults to "0". so when I have multiple records all with "0" or the same value they cannot be sorted properly.

      I have the dynamic list recordset sorting by this "sort" field and if I go in and manually change the records values to different sequential numbers it begins to work perfectly. Its not until I introduce a new record does this start to throw a wrench into things.

      So I need to figure out how to make sure a value in this "sort" column field in my database can never equal another value in the same field for any of the records.

      I know the scripts increase and decrease the integer by 1, so how can I maintain this without having duplicate values?!

        • 1. Re: move up/down column not working fully, thought i had it but i was wrong
          dizmarkie Level 1
          I got it going. I just to make sure that my sort field in my DB was set to "unique"

          I also made sure I had the sort trigger initiated with this code

          //start Trigger_SetOrderColumn trigger
          //remove this line if you want to edit the code by hand
          function Trigger_SetOrderColumn(&$tNG) {
          $orderFieldObj = new tNG_SetOrderField($tNG);
          return $orderFieldObj->Execute();
          //end Trigger_SetOrderColumn trigger

          The "sort_order" is the name of my sort field in my DB.The only thing now that gives me troubles if I use the "insert as new" function on my detail form. It tries to duplicate the same value in the sort field and I MYSQL throws errors since that field is set to unique.

          How would I get this value to insert a different value on "insert as new" to ensure mysql doesnt throw any errors?