I have a report layout (with child groups) and I want to export only the report of a specific set of features.
I tried to check if the fid
matches with @atlas_featureid
variable but I couldn't find any function to access this variable from the Python console.
How can I export only the reports for a specific set of features?
Edit: I've managed to "solve" the problem using the following workaround:
for feature in layer.getFeatures():
report_index = feature.attribute('fid')
QgsExpressionContextUtils.setProjectVariable(project, 'rik_report_index', report_index)
filename = str(report_index) + '.pdf'
result, error = QgsLayoutExporter.exportToPdf(report, project_dir + '/reports/' + filename, settings)
And I've wrote the formula @atlas_featureid != @rik_report_index
on the following field:
But...
The time of the process increases exponentially.