# Sent report is not filtered

**URL:** <https://forum.inductiveautomation.com/t/sent-report-is-not-filtered/65539>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [October 21, 2022, 4:33pm UTC](https://forum.inductiveautomation.com/t/sent-report-is-not-filtered/65539 "2022-10-21T16:33:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![yehet73190](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yehet73190/32/68157_2.png) [@yehet73190](https://forum.inductiveautomation.com/u/yehet73190)\
**Post date:** [October 21, 2022, 4:33pm UTC](https://forum.inductiveautomation.com/t/sent-report-is-not-filtered/65539/1 "2022-10-21T16:33:36Z")

</div>

When trying to use `system.report.executeAndDistribute` to send the report via email I noticed that the report I try to send is for example filtered to just 5 pages but the report that I receive via email is not filtered at all.

Below is the code, is there something wrong or missing that I need to add?

```auto
system.report.executeAndDistribute(path = event.source.parent.getReport, action = "email", actionSettings = {"to":recipients, "smtpServerName":mailServer, "from":fromAdd, "subject":subject, "attachmentName":subject, "body":body})

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 21, 2022, 4:37pm UTC](https://forum.inductiveautomation.com/t/sent-report-is-not-filtered/65539/2 "2022-10-21T16:37:05Z")

</div>

You are not providing any parameter overrides, so the report is executed using the default parameter values.

```auto
system.report.executeAndDistribute(path = 'path',parameters = {'your parameter':'your paremter value'}, action = 'action')

```

---

<div class="post-metadata">

**Author:** ![yehet73190](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yehet73190/32/68157_2.png) [@yehet73190](https://forum.inductiveautomation.com/u/yehet73190)\
**Post date:** [October 21, 2022, 4:45pm UTC](https://forum.inductiveautomation.com/t/sent-report-is-not-filtered/65539/3 "2022-10-21T16:45:12Z")

</div>

is the "actionSettings" that are specified different from the parameter override?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 21, 2022, 5:01pm UTC](https://forum.inductiveautomation.com/t/sent-report-is-not-filtered/65539/4 "2022-10-21T17:01:19Z")

</div>

Yes, the `actionSettings` are specific to the indicated `action` that the function should take once the report is executed. The parameters give the report values to use when generated.

---

<div class="post-metadata">

**Author:** ![yehet73190](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yehet73190/32/68157_2.png) [@yehet73190](https://forum.inductiveautomation.com/u/yehet73190)\
**Post date:** [October 21, 2022, 5:16pm UTC](https://forum.inductiveautomation.com/t/sent-report-is-not-filtered/65539/5 "2022-10-21T17:16:16Z")

</div>

Changed it to this but I'm not receiving the email and seeing this error on console

`system.report.executeAndDistribute(path = event.source.parent.getReport, parameters = {"to":recipients, "smtpServerName":mailServer, "from":fromAdd, "subject":subject, "attachmentName":subject, "body":body}, action = "email")`

"SMTP server name in Email does not exist."

But it does exist, and I've tested that it's working

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [October 21, 2022, 5:49pm UTC](https://forum.inductiveautomation.com/t/sent-report-is-not-filtered/65539/6 "2022-10-21T17:49:20Z")

</div>

You have to provide the parameters for the report, and the settings for the action. They are not the same thing.

For example, lets say that your report has a `startDate` and an `endDate` parameter. By default `endDate = now()` and `startDate = addHours(now(),-24)`

If you were to call

```python
actionSettings = {'to':recipients,'smtpServerName':mailServer,'from':fromAdd,'subject':subject,'attachmentName':subject,'body':body}
action = 'email'
system.report.executeAndDistribute(path=event.source.parent.getReport,action=action,actionSettings = actionSettings)

```

You would get a report emailed that is executed for 24 hours of data, if instead you wanted only 5 hours of data you would need to call it like this:

```python
actionSettings = {'to':recipients,'smtpServerName':mailServer,'from':fromAdd,'subject':subject,'attachmentName':subject,'body':body}
action = 'email'
parameters = {'startDate':system.date.addHours(system.date.now(),-5)}
system.report.executeAndDistribute(path=event.source.parent.getReport,parameters = parameters,action=action,actionSettings = actionSettings)

```

---

<div class="post-metadata">

**Author:** ![yehet73190](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yehet73190/32/68157_2.png) [@yehet73190](https://forum.inductiveautomation.com/u/yehet73190)\
**Post date:** [October 21, 2022, 6:29pm UTC](https://forum.inductiveautomation.com/t/sent-report-is-not-filtered/65539/7 "2022-10-21T18:29:13Z")

</div>

ohhh im so dumb, thank you for clarifying! its working now! 🤩
