Using Report Variable in Board Button as Value for Custom Field
Asked by Rebekah LEPRO Metz:

I need to periodically generate a To Do report which includes cards contained in multiple lists across one board - if the cards have a designated (variable) value in the Custom Field.

Then I need to mail the report to a designated (variable) email address. I am hitting a limitation when attempting to use a *$report_variable*when filtering the cards collected for the report

++My solution:++

I created a board button with the following action steps.

First, I maintain two cards with reference information and when I want to create the report, my board button first creates two report variables: $email_des and $owner from that reference information.

```
create a report in variable "email_des" with all cards in list "Resources" with the "Tracking" label using pattern "{carddescription}",

create a report in variable "owner" with all cards in list "Resources" with the "Owner" label using pattern "{carddescription}",
```

Next, I collect all the cards (with a report pattern) that have the custom field "Business Owner" set to the value in {$owner} into a third report variable $to_do.

```
create a report in variable "to_do" with all cards without the purple "Workstream" label with custom field "Business Owner" set to {$owner} without the green "COMPLETE" label using pattern "[{cardname}]({cardlink}) \n\n _Next Step:_ {{%Next Step}} \n\n\n", 
```

Finally, I email the report in $to_do using also the value of $email_des for the recipient and value of $owner in the subject line.

```
and send an email notification to {$email_des} with subject "To Do List for {$owner} for {isodate}" and message "{$to_do}\n\n--- ---\n\n\n"
```

++The result:++

There are no cards collected into the report {$to_do}. However, there is a value in {$owner} because the email subject does contain the correct value from {$owner}.

++Some troubleshooting:++

If I replace {$owner} with hardcoded value in the $to_do report definition; the cards are collected into $to_do. Further, if I replace {$owner} with {username} and change the value of "Business Owner" custom fields for a few cards. This results in those cards where "Business Owners" is set to {username} being collected into the report $to_do.

I can't find anything about a limitation of using a report variables to filter cards collected for a report based on match to a custom field value. Has anyone encountered this limitation and solved it for a similar reporting need?

Is there a different way to use a variable value while filtering cards collected for a report?


Answers:
author: milynnus
body: [@Rebekah LEPRO Metz](/t5/user/viewprofilepage/user-id/4362146)

It is a long post. Question : why is the criteria for cf set to report variable {$owner}? It is interesting idea your are trying out. Note that report variables would be comma delimited.

comments: author: Rebekah LEPRO Metz
body: Each card on the board already has a designated value in a Custom Field titled "Business Owner."

The report variable {$owner} is used (1) when collecting cards for a report - as criteria to filter the existing cards across the board where the value in the "Business Owner" custom field is the same value in {$owner} and (2) to set the subject line in the emailed report.

#1 does not work; #2 works.

All actions are part of a single Board Button definition.


author: milynnus
body: [@Rebekah LEPRO Metz](/t5/user/viewprofilepage/user-id/4362146)

I used to send report variable via http request to an endpoint and the first thing I do is to spilt by the delimiter. Correction to my earlier post - it should be a \\n

Unknown to you the value is not the owner but it has a \\n at the end.

> ```
> item_list = para['report_variable'].split("\n")item_list.pop() #remove last element
> ```


author: Rebekah LEPRO Metz
body: So helpful to know about the \\n

I'm not familiar with a way to split and pop from within the Butler interface when defining button rules. Might you be able to point me to any resources for learning more about using those functions within Butler?

Thank you!


author: milynnus
body: [@Rebekah LEPRO Metz](/t5/user/viewprofilepage/user-id/4362146)

Butler does not have the function to support string manipulation. What I am showing you is the portion of my python code that runs via a Butler Http request whenever I send a {$report_variable} to it.

---

In particular, I found a way enable Butler users to use the report variable with downstream Butler actions for example making it into a checklist so that you can use "for each item in checklist" . This will enable users to schedule more Butler actions that can be attached to report variables.


Tags: butler

report

variable