4 Replies Latest reply on Jul 5, 2011 8:30 AM by philmodjunk

    Monthly statement script/calc?

    OwenKlingdon

      Title

      Monthly statement script/calc?

      Post

      I'm trying to generate individual files for what near as I can tell would be like a monthly statement.  I want to look up an employee in the employee table, then find all the records associated to them in a customers table, and export that info to Excel.  Then repeat the process with the next employee.  It seems like it should be pretty easy but I get a lot of strange results from various strategies I've tried.  Any thoughts?  Thanks in advance.

        • 1. Re: Monthly statement script/calc?
          rjlevesque

          You need a loop, to go through each record until the last record, and then exit loop, halt script

          • 2. Re: Monthly statement script/calc?
            rjlevesque

            wait, I take that back, the more I think about it you may actually need a nested loop here with an IF statement.

            Little more specific: You need to write your entire script for what you need to do first. (i.e. take an employee's name and grab all records related to that employee, and spit it out in an excel sheet.)

            That will require a loop to start with the first employee, run the procedures, and then go to the next employee and run them again, etc until the last employee is reached.

            However, depending on what all kind of records you need to grab related to that employee you may need a loop to search through all your records and find them all. Thus, you end up with a loop statement inside a loop statement.

            Hope that cleared that up instead of confuse you more... LOL

            RJ

            • 3. Re: Monthly statement script/calc?
              OwenKlingdon

              I know I need a loop what i'm not sure of is from respect of which table.  My thinking was a loop, that starts in the customer table, grabs the employee in that table, does a find in customers table based on that name, exports results to excel and goes on to the next employee, however I had no luck with that strategy so i'm missing something in behind or something.

              • 4. Re: Monthly statement script/calc?
                philmodjunk

                It's hard to tell what you might be missing without knowing more about your system. This basic strategy, though using an employee ID number instead of a name is a better approach, should work for you.