3 Replies Latest reply on Apr 5, 2010 12:46 PM by philmodjunk

    Help with Script Please!

    mgxdigital

      Title

      Help with Script Please!

      Post

      I'm in need of help with a script.

      If anyone can help me write this out, i would be so grateful :smileyhappy:

       

      I need a script where i can find all records based on a salesperson field, date field, invoice paid field, and commission paid field.

       

      I'd like the script to be able to search for the salesperson based on manual enter of the salesperson name, then search from 1/1/10 to current date, then also be able to search for a checkbox in the invoice paid field to be marked. Then i'd like it to search for the commission paid checkbox to by UNMARKED.

       

      So example:

      I'd maybe like a popup box to come up to ask for the inititals of the salesperons:

      I can type in my initals and FM will search for me, all records since the beginning of the year where the invoice has been paid, but the record has not recieved commission.

       

      This is really tough for me to figure out so i'm hoping someone can help me out please

        • 1. Re: Help with Script Please!
          philmodjunk

          Check for understanding:

          You want all records where:

          Salesperson name = user specified name AND

          InvoiceDate > first day of current year AND

          InvoicePaid = "Paid"  (the selected value in the value list) AND

          commission paid field is empty

           

          Script:

          (assumes salesperson name is entered in global field called gSalesPerson)

          Enter Find Mode[]

          Set Field [Invoices::SalesPerson ; gSalesPerson]

          Set Field [Invoices::InvoiceDate ; "> " & Get ( CurrentDate ) - DayOfYear ( Get ( CurrentDate ) ) + 1 ]

          Set Field [Invoices::InvoicePaid ; "Paid" ]

          Set Field [Invoices::CommissionPaid ; "=" ]

          Set Error Capture [on]

          Perform Find []

          • 2. Re: Help with Script Please!
            mgxdigital

            Hi Phil,

            Can you help me with the salesperson input field?

             

            Our Salesperson field is just an edit field. We only have 3 salespeople and whenever a new customer record is made, we enter in the salesperson's initals.

             

            In the script, we have set field, but where can we enter in the salesperson's initals that we need to search for?

            • 3. Re: Help with Script Please!
              philmodjunk

              Use a global field for this. In my example, that's what gSalesPerson refers to. The user would enter the intials in this field and then start the script.

               

              Alternatively, you can capture this in a variable.

               

              The first part of the script would be changed to:

              Set Variable [$SalesPers ; Value: SalesPerson ]

              Enter Find Mode[]

              Set Field [Invoices::SalesPerson ; $SalesPers]

               

              That approach avoids using a global field.