5 Replies Latest reply on Dec 16, 2016 10:00 AM by David Moyer

    Script-Find Empty Fields


      Hello folks.


      In my list layout, I have a field named 'Custom Price'. The database has about 275 records. Sometimes I perform a find request for about 75 items to send off to a client as a catalogue, however, some customers get special pricing.


      I go in record by record and put in the prices and then click a button which takes me to a nice catalogue layout and I am now able to save as a PDF to send out. But what if I forget to put in prices for some of the products? I want the script that is attached to my 'SAVE AS PDF' button send a message to me that some of the found records do not have prices. This would allow me to go back and check for the ones I missed.


      I have attached the script I am using now but don't think it checks every record. IfI put in custom pricing in only one of the 75 records, I don't get the message that some price fields are empty. (is there a loop I'm missing?)


      Any help would be appreciated.


      Happy Friday.



        • 1. Re: Script-Find Empty Fields

          Actually, it seems you're only checking the first record ... (or more to the point, the record you happen to be on after the Sort).


          You could write a loop, but a Find seems more straightforward:


          Enter Find Mode

          Set Field [ Master File::customPrice ; "=" ]

          Set Error Capture [ on ]

          Constrain Found Set

          If [ Get ( FoundCount ) ]

            Show Custom Dialog [ "Missing prices ..." etc. ]

            Exit Script

          End If

          • 2. Re: Script-Find Empty Fields
            David Moyer


            here's what pops out to me:  first, your Get(LastError) <> 0 seems to be checking if Show/Hide Toolbars worked.  Secondly, after sorting (presumably by Custom Price), you need to Go to Record, First.

            • 3. Re: Script-Find Empty Fields

              I agree with erolst, but since you are performing a find to get the records you want for the PDF, you need to do this in a way that does not lose that found set.


              So take the suggested script and add a "New window" script step at the beginning of it and then add a close window step at the end and just before any exit script step. That way, your script uses the other window to do the check and leaves the found set in your current window unmodified.

              • 4. Re: Script-Find Empty Fields

                Thanks for these suggestions. I'll dive in a little later today to see what I come up with.

                • 5. Re: Script-Find Empty Fields
                  David Moyer

                  just to explain a bit better ... when you look at your set of records, the first record might have a price of 75.  Once you sort by price, the record showing will be the same - with a price of 75.  Once you go to what is now the first record in the sorted set, you'll encounter an empty price, if any exist in your found set.