1

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: enter image description here

But...

The time of the process increases exponentially.

1
  • 1
    Instead of editing the Question to state you solved the problem (and introduced a new one), you should focus the Question on the performance problem.
    – Vince
    Commented Jan 26, 2023 at 14:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.