6 Replies Latest reply on Nov 19, 2010 2:10 PM by SwissMac

    Same report for many people - filter by pick list

    SwissMac

      Title

      Same report for many people - filter by pick list

      Post

      I often need to create a particular report for each individual staff member, giving them an overview of what jobs have been allocated to them. At the moment I am creating one report per employee that shows only that employees work allocation and which shouldn't be seen by colleagues. Even if I duplicate the reports and scripts I still have to change the layout, the script, then back to the layout again to update the script trigger and so on.

      Since I'm using a computer that doesn't mind doing repetitive tasks for me, I wondered if anyone could recommend a way for me to create one single report, and then have a selection process of some sort in which the employee presses the button to call the script and is then presented with a dialog box of some sort so they can pick their own name from a list of employee names and then report is then generated based on that?

        • 1. Re: Same report for many people - filter by pick list
          philmodjunk

          The details will depend on your tables and the design of your report, but you shouldn't have to change your layout design with each version of the report.

          If you are selecting a value from a drop down list formatted field, you can use the value selected in this field in a script that finds records with this value:

          If the drop down field is a global field, it might look like this:

          Enter Find Mode[]
          Set Field [Yourtable::YourField ; YourTable::YourGlobalDropdownlistField ]
          #you can use as many set Field steps as you need here to specify criteria for the find
          Set Error Capture [on]
          Perform Find []

          If by picklist, you mean a list of records in a list view layout or a portal and you want to click a row to produce a report for that person, that can also be done with a slightly differnt version of the same script.

          • 2. Re: Same report for many people - filter by pick list
            ryan

            Does each employee login to the DB using their name or some sort of unique id?

            If so,  I was wondering if you could use one button on the layout and use Get (UserName) in the Script parameter to pass on into your script?

            • 3. Re: Same report for many people - filter by pick list
              SwissMac

              Thanks for that quick reply - we'll have to spend less time working together, I've now caught your head cold! Laughing

              I'm not sure if what you have described will do what I want... my brain's gone on strike this afternoon. I'll give you more details:

              I have a report that lists which employee is responsible for completing which tax returns, grouped by employee so that:

              Joe
              Mr Jones, Mr Smith, Mr Taylor (the names would be vertically listed, I've compressed that for ease of explanation here)

              Sally
              Mr Brown, Miss Clark

              Peter
              Mr and Mrs Evans, Mr Harris, Miss Phillips, Mr Williams

              The problem is that Peter and Sally can see who Joe is working on, and vice versa. I want a way so that a single layout generates a report that has only Joe, or only Sally, or only Peter on it AND that the selection of which employee is chosen is made at runtime as in

              Press button - Dialog box asks which employee - employee selects own name - report is generated with that employee's list of tax returns.

              If Sally picked her name (or typed it in) the report would show:

              Sally
              Mr Brown, Miss Clark

              I don't want any of the layout or the list of all tax returns to be shown before the employee name to be used as the filter has been added. You'll probably tell me that's exactly what your answer gives, in which case I apologise but I didn't quite get it.Embarassed

              • 4. Re: Same report for many people - filter by pick list
                SwissMac

                While I like the idea of using UserID as the determinant, I haven't learned about that yet so I may leave that one for the future... great idea though. I just don't know anything about UserIDs and I'm still learning the other stuff!Undecided

                • 5. Re: Same report for many people - filter by pick list
                  philmodjunk

                  Well yes, that's exactly what I had in mind, but I had to keep it pretty vague as I didn't have all the details. Wink

                  Your script can also change layouts or you can pop up a window where the user fills in criteria and then clicks a button to dismiss the window and kick off the find.

                  Without using pop-up windows, you might have a script like this:

                  Go To Layout [//specify your report layout]
                  Enter Find Mode[]
                  Set Field [Yourtable::YourField ; YourTable::YourGlobalDropdownlistField ]
                  #you can use as many set Field steps as you need here to specify criteria for the find
                  Set Error Capture [on]
                  Perform Find []

                  This allows you to have your drop down list and any other global fields you want to use for specifying the criteria you want for performing the find on one layout with a button to kick off the above script. This is just a general outline of a script here there are a lot of variations possible, including adding a sort step to sort the found records correctly.

                  If you want to pop up a window to collect the info, you may be able to use Show Custom Dialog with input fields--this has some limitations, but its fairly easy to use if you can live with the limits. For a more sophisticated approach, you can use the New Window command. You can find an example of this in my Known Bug List: 

                  http://www.4shared.com/file/8orL8apk/FMP_Bugs.html

                  Don't go there unless you have to and be prepared to ask questions about it as it uses some fairly sophisticated tricks that can lock your file in an infinite loop if you don't set it up correctly.

                  • 6. Re: Same report for many people - filter by pick list
                    SwissMac

                    Many thanks for posting that, looks like that's another job for the weekend then!Smile