# Automation script Schedule PM with Data Explorer results not sending PMs

**URL:** <https://meta.discourse.org/t/automation-script-schedule-pm-with-data-explorer-results-not-sending-pms/269135>\
**Category:** Bug\
**Tags:** automation\
**Created:** [June 21, 2023, 9:46am UTC](https://meta.discourse.org/t/automation-script-schedule-pm-with-data-explorer-results-not-sending-pms/269135 "2023-06-21T09:46:11Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)\
**Post date:** [June 22, 2023, 1:50am UTC](https://meta.discourse.org/t/automation-script-schedule-pm-with-data-explorer-results-not-sending-pms/269135/20 "2023-06-22T01:50:25Z")

</div>

> [@JammyDodger](#):
>
> I think it’s something to do with the `user_id` style magic the [data explorer](https://meta.discourse.org/t/32566) does when it converts them from bare ids to useable links. If I run your report as is it errors out just like you’re seeing, but if I remove both `t.user_id` and `t.last_post_user_id` from the SELECT it does work.

It’s this line: [https://github.com/discourse/discourse-data-explorer/blob/705753216cc632b4f6505d2000926ab3b73d8628/lib/result\_to\_markdown.rb#L20](https://github.com/discourse/discourse-data-explorer/blob/705753216cc632b4f6505d2000926ab3b73d8628/lib/result_to_markdown.rb#L20)

` related = relations.dig(colrender[col_index].to_sym) if col_index < colrender.size`

The `if` condition on the end is incorrect: `colrender` is supposed to be sparse, not packed. It will contain nulls if some but not all columns provide extra rendering data.

The correct check would probably be `unless colrender[col_index].nil?`

Also, this code appears to neglect the `url`, `reltime`, and `html` rendering types because they’re not ActiveRecord classes.

---

_[View the full topic](https://meta.discourse.org/t/automation-script-schedule-pm-with-data-explorer-results-not-sending-pms/269135)._
