<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: format a token/variable in email a scheduled email with pdf attachment in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360602#M6253</link>
    <description>&lt;P&gt;what about - &lt;CODE&gt;eval x=strptime($job.latestTime$,"%Y-%m-%d")&lt;BR /&gt;
2. &lt;BR /&gt;
3. $result.x$ &lt;BR /&gt;
&lt;/CODE&gt;&lt;BR /&gt;
Assuming x is in the search?&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/Report/Schedulereports#Use_tokens_in_scheduled_report_email_subjects_and_bodies"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/Report/Schedulereports#Use_tokens_in_scheduled_report_email_subjects_and_bodies&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2018 16:12:04 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2018-02-08T16:12:04Z</dc:date>
    <item>
      <title>format a token/variable in email a scheduled email with pdf attachment</title>
      <link>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360601#M6252</link>
      <description>&lt;P&gt;When I run a scheduled report with PDF atachment, I can use this token in the email body: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$job.latestTime$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which will result in the following in the email body when the email is sent: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; 2018-02-08T10:09:02.000+13:00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I format this time/date to be as follows YYYY-MM e.g. 2018-02? &lt;BR /&gt;
Or one step further would be to do current month minus 1 month e.g. 2018-01? &lt;/P&gt;

&lt;P&gt;I was thinking something like this &lt;/P&gt;

&lt;P&gt;Assuming:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$job.latestTime$    = 2018-02-08T10:09:02.000+13:00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then I thought I could do something like this in the email body: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval x=strptime($job.latestTime$,"%Y-%m-%d")

x = $x$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this does not work. Can I do what I am trying to do here&lt;/P&gt;

&lt;P&gt;docs here which gives a list of the available tokens : &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/Report/Schedulereports"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/Report/Schedulereports&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 22:15:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360601#M6252</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2018-02-07T22:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: format a token/variable in email a scheduled email with pdf attachment</title>
      <link>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360602#M6253</link>
      <description>&lt;P&gt;what about - &lt;CODE&gt;eval x=strptime($job.latestTime$,"%Y-%m-%d")&lt;BR /&gt;
2. &lt;BR /&gt;
3. $result.x$ &lt;BR /&gt;
&lt;/CODE&gt;&lt;BR /&gt;
Assuming x is in the search?&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/Report/Schedulereports#Use_tokens_in_scheduled_report_email_subjects_and_bodies"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/Report/Schedulereports#Use_tokens_in_scheduled_report_email_subjects_and_bodies&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 16:12:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360602#M6253</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-02-08T16:12:04Z</dc:date>
    </item>
    <item>
      <title>Re: format a token/variable in email a scheduled email with pdf attachment</title>
      <link>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360603#M6254</link>
      <description>&lt;P&gt;when you say &lt;CODE&gt;Assuming x is in the search?&lt;/CODE&gt; &lt;BR /&gt;
I am having trouble with this as it is a dashbord with many searches making tables and charts. So does this still apply?&lt;/P&gt;

&lt;P&gt;One of the searches is a table that has a field/column called CallSuccessRate. So I have tried to put $result.CallSuccessRate$ in the email body but that just comes through as a blank in my email. &lt;/P&gt;

&lt;P&gt;Do I have to configure something in the scripts? &lt;/P&gt;

&lt;P&gt;tks&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 20:47:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360603#M6254</guid>
      <dc:creator>HattrickNZ</dc:creator>
      <dc:date>2018-02-08T20:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: format a token/variable in email a scheduled email with pdf attachment</title>
      <link>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360604#M6255</link>
      <description>&lt;P&gt;Tokens available from results&lt;BR /&gt;
From results, you use the result. token to access the first value of a specified field in search results. This token is available from the following contexts:&lt;/P&gt;

&lt;P&gt;Alert actions&lt;BR /&gt;
Scheduled reports&lt;BR /&gt;
Token   Description&lt;/P&gt;

&lt;H1&gt;$result.fieldname$  Returns the first value for the specified field name from the first result in the search. The field name must be present in the search.&lt;/H1&gt;

&lt;P&gt;Does not specifically say if the token can be used IN the body of the email, but can you check if $result.CallSuccessRate$ comes in something like the alert subject line or something&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 18:10:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360604#M6255</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2018-02-09T18:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: format a token/variable in email a scheduled email with pdf attachment</title>
      <link>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360605#M6256</link>
      <description>&lt;P&gt;Is there an answer that works for scheduled dashboards? With a dashboard, I don't believe you have access to the $results... token.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 13:37:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/format-a-token-variable-in-email-a-scheduled-email-with-pdf/m-p/360605#M6256</guid>
      <dc:creator>danielswan</dc:creator>
      <dc:date>2019-06-27T13:37:57Z</dc:date>
    </item>
  </channel>
</rss>

