AnsweredAssumed Answered

Incosistent Script

Question asked by TurtleKoala on Sep 7, 2012
Latest reply on Sep 7, 2012 by philmodjunk

Title

Incosistent Script

Post

I have two tables, Employee and Projects. The Employee table is guaranteed to contain on record per employee, while the Projects table can contain any number of records per employee, including zero. I also have a Global table with global fields gFirst and gLast. I have three relevant layouts.

The first is a layout based on the Global table with a place to enter an employee's first and last name in gFirst and gLast respectively. There is also a button that runs a script which generates a report using one of the other two layouts.

The second layout is based on Projects. This is the report that I would rather use, but given that not all employees have projects, I cannot use this for all employees. This is the purpose of my third layout.

The script to generate the report first enters browse mode. Then it performs the following check.

If[IsEmpty ( FilterValues ( List ( Projects::First Name ) ; Global::gFirst ) ) or IsEmpty ( FilterValues ( List ( Projects::Last Name ) ; Global::gLast ) )]

If the check succeds I generate the report based on Projects. If it fails, I generate the report based on Employees. For some reason, the first time I run the script it always generates the report based on Employees, but when I run it again it correctly generates the report based on Projects.

What is happening?

Outcomes