3 Replies Latest reply on Sep 22, 2013 8:22 AM by philmodjunk

    Conditional formatting, script triggers.

    SteveMartino

      Title

      Conditional formatting, script triggers.

      Post

           Hello forum.  I was trying to solve something which is probably simply, but cant seem to get it quite right.  I have a layout, in form view, that shows a list of records.  In the first field (column) I have a script trigger (OnObjectExit).  The purpose is to enter a number in the field, hit enter, then the trigger fires and resorts the order.  This way I can pick different records, in the order I wish to deliver, and print the list.

           The problem, if I just do a sort, all the blank fields show up at the top--so if there are 50 found records, and I put in a "1" (no quotes of course), the record comes in last, If I then put in a 2, then I have 48 blanks, then record 1, and record 2.

           Things I tried:

           On layout open, replace all fields with the number 999.  This found set will never have more then 50 records.  Conditional format so if the number is 999, text same color as field, so its hidden.  The only problem, when I click on a "blank" field, the 999 shows up, then I overtype the number I want, and hit enter--works fine. 

           Just trying to figure out if there is a better way to avoid the 999, or not have it show when I click on the field.  I tried (maybe incorrectly) to conditionally format the 999 in all it states, and I tried conditionally formatting the 1,2,3's and doing it the opposite way, but maybe I'm missing something.  I thought in layout mode, for this field I could pick no color (box with line thru it) and conditionally format the non 999's but it doesn't let you select that option.

           I also tried making the 999 text very large (being it is invisible) but it wants me to resize the field, which doesn't work.  And if I say yes to this, I can not resize the box smaller.

           Not a big deal, but any thoughts/help would be greatly appreciated.

           Thanks

           Steve

           PS  Another thing I wanted to do was to make sure when I entered a number there wouldn't be any duplicates, but using my 999 method, I cant using any validation options (well I cant figure out how to use any :) )

        • 1. Re: Conditional formatting, script triggers.
          philmodjunk

               Use a hidden calculation field for your sort order:

               If ( IsEmpty ( YourTable::VisibleFIeld ) ; 999 ; YourTable::visibleField )

               Then sort on this calculation field. And if you sort the field when the layout is first opened, you can specify the "Keep Records in Sorted Order" option and you shouldn't then need any script trigger to have the records automatically resort as you modify your visible "sort order" field.

               Edit Note: Missing Parenthesis has been added.

          • 2. Re: Conditional formatting, script triggers.
            SteveMartino

                 Thank again Phil.  I couldn't get the calculation to work (said "too many parameters').  After fiddling around I realized there's a slight typo, missing a ) parenthesis after the first YourTable::VisibleField .  I only mention this so you can edit it in case someone else sees the posts then has trouble with the calculation.

                 Works great!  (as if you didn't already know that) :)

                 Thanks Phil.

                 PS The calculations should be unstored, right?

                 PPS Oh crap I clicked the wrong post for Correct Answer.

            • 3. Re: Conditional formatting, script triggers.
              philmodjunk

                   I'd say that you clicked the correct one as the best answer was to take my deficient calc and fix it. wink