Saturday, June 20, 2009

Should I use the Resource Type measure

(Q) Why do I get records full of NULLs when I'm using the Resource Type measure?

(A) This question is about ClickAnalyze Reporting for ClickSchedule. More specifically it is raised in regards to the Resource Schedule report.

By now, you probably noticed that engineers with assignments have one record per assignment, but engineers with no assignments have one record full of NULL values. The NULL values are at the columns, which hold the assignment and task details.

Why there is no such record for engineer with assignments? Why engineer with no assignments, don't have zero records? Meaning that this NULLs record should not be written at all!

Well, the answer is in the question: the Resource Type measure.

When the reporting infrastructure initialize the calculators (measures), each calculator declares what type of objects it needs. In the first screen-shot we can see that Resource Type asks for Engineer objects (see the Conditions and Data Filter properties).

The "Task" measure is a Get Schedule measure type. It's also requires Engineer objects, but it returns matrix of values.

Here is the place to explain what is this "matrix of values": Each calculator defines list of columns that it can populate. The Get Schedule calculator defines this list from the parameters entered by the user (Task Properties and Assignment Properties). Assuming the list is made of 5 task properties and 3 assignment properties, then the calculator defines 8 sub-columns. Each time the infrastructure is calling the calculator with Engineer objects, it prepares array with 8 NULL values, and the calculator can write values into those places. But here comes the special part, the Get Schedule calculator fills the 8 values from the first task-assignment pair, and then calls the infrastructure to AddRow. The infrastructure duplicate all values of the preceding dimensions and measures and prepare new array of NULL values, so the calculator can now start writing the second row of the matrix, and so on.

When the Get Schedule calculator have no assignments to process, it leaves the array full of NULL values and exit. If the infrastructure finds that all measures are returning only NULL values, then the record is not written to the database.

BUT, in our case, the Resource Type measure always write a string value, so we get this record full of NULL values (the NULL values, which the Get Schedule measure did not fill).

We should note that by design, the special "matrix measures" should be the only measure in the report. It is by coincidence that the infrastructure supports one "matrix measure" as the last measure, even when it is preceding with other simple measures.

I would expect this Resource Type calculator to be removed. The same can be achieved by adding the properties to the "Resource" dimension. In this way, records full of NULL values, will not be written to the database.

No comments:

Post a Comment

Please keep comments clean at the ClickDev blog.

 
HTML Hit Counter