Open dr01d3r opened 3 days ago
@lsgs Given all this info, I wish I had any insight to a solution, but not really sure how you'd want to approach this. The problem is global absence of data, and it can be tricky when trying to render headers and rows that are supposed to repeat. Perhaps if you were able to determine that the entirety of an instrument is absent data across all rows, you simply omit those columns?
Given a project that has repeating instruments, and a simple report that outputs both repeating and non-repeating data, if none of the
$rows
rendered bydoReshapedReport
have instances of the repeating instrument, the module will throw an exception.I've narrowed it down to the following code:
https://github.com/lsgs/redcap-extended-reports/blob/89a1bd7069c014eb1dc08ff6781c934cff5a3d5c/Report.php#L963-L964
Here's some example
$rows
data afterdoReshapedReport
. The first 2 fields are flat, and the 2nd two exist on the same repeating instrument.And the header info for one of those repeating fields configured in the report:
So the noted lines of code default the value to an empty array, but since the field is part of the headers and the
instance_count
is 0, the field stays an empty array.This eventually causes the following line to fail due to an array being used as the key:
https://github.com/lsgs/redcap-extended-reports/blob/89a1bd7069c014eb1dc08ff6781c934cff5a3d5c/Report.php#L1483
When there is at least one record with data in those repeating fields, the data looks more like this:
And