Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

With the latest version of Dream Report (4.6x), this is very simply accomplished:

  1. Open the “General” tab of the Report Settings, and click the “Configure File Timestamp” option to be the “Report Start Period”, and then select “Last 1 Day”:
    Image Removed
  2. Then, in the “Report Name Format” tab, either use the default setting (which uses the full date/timestamp), or select and add “Date” only, if the time is not needed in the file name:
    Image Removed

Unfortunately, Dream Report 4.5x did not include this feature, so there are several steps you need to follow to create an object containing “yesterday’s date”, and then reference that object in the Report Name Format.

...

In Dream Report Studio:

1) Place a “Date and Time” object on the report

2) Name the object “rptDate”

3) Set the Option for Dynamic Generation to be “Start of Report period”

4) Select the Date (and Time, if needed), and set the formatting

5) For the Time Definition, select “Fixed Period – Last 1 Day”
Image Removed

...

Since the Date and Time object is returned in Unix time, we have to format it into a local time format. To do this, we use an Expression object, and use a Lua script to format it as needed. In Dream Report Studio:

1) Place an “Expression” object on the report

2) Name the object “ReportDate”

3) In the expression area, enter the following expression exactly as shown:

(function() return os.date("%m-%d-%Y", [dt#rptDate]) end)()

You can change the date formatting, as well as adding the time component, as needed. Appendix A describes additional formatting option..

4) This expression referenced the “rptDate” object we created previously

5) If you want to hide this object on the report, simply select the “Result Representation” tab, and uncheck the “Visible” option
Image Removed

Now that we’ve created a formatted Date object with yesterday’s date, we can reference it in the Report Name Format. Open the Report Settings, select the “Report Name Format” tab and configure the name as follows:

1) Delete the [d#FULL_TIMESTAMP] parameter from the “Report filename mask”

2) In the “Select Data Item” section, click the browse […] button

3) Select the “Analytics” driver in the “Select Data Source” list. “Analytics” is an internal driver, which exposes all named items/objects on every report.

4) Double-click your report from the list (in this example, the report name is “Daily Report”, and then select the “ReportDate” object we created in the previous section

5) Once selected, click the “Add” button in the “Select Data Item” section, to add this item to the Report Filename Mask. The result should look like:

 [s#ReportName]+_+[i#Analytics.Daily Report:ReportDate]

...

Lua Script Date and Time Manipulation

The following table shows each tag, its meaning, and its value for September 16, 1998 (a Wednesday), at 23:48:10. For numeric values, the table shows also their range of possible values. Reference Для того, чтобы добавить в имя отчёта собственный формат даты, в версии 4.6х и более новых, необходимо сделать следующее:

1.      В настройках отчёта открыть вкладку “Общие” и нажать на кнопку “Определить временную метку”, выбрать вариант “Время начала периода” и выбрать «Фиксированный период» времени и “Последний 1 день”:Image Added


2. Затем, на вкладке “Формат имени отчёта”, использовать настройки по умолчанию (они позволяют использовать полный формат даты и времени), или выбрать и добавить только “Дату” в случае, если нет необходимости добавлять в имя отчёта время:

Image Added


Скрипт Lua для работы с датой и временем

Таблица ниже показывает тэг, значение которого соответствует 16 Сентября 1998 (Среда), 23:48:10. Для цифровых значений таблица также показывает диапазон этих значений и возможные варианты значений. Описание можно найти здесь http://www.lua.org/pil/22.1.html

In

a В объекте Dream Report Expression object, the syntax to show a “full” date and time, with date elements separated by forward slashes (/) and time components separated by colons (:) would be as follows«Выражение», синтаксис выражения для того, чтобы показать «полное» время и дату с элементами, где дата разделена знаком «-» и время знаком (:), будет следующим:

(function() return os.date("%Y-%m-%d %H:%M:%S", [f#exp3]) end)()

Where Где [f#exp3] is an object which exists on a report.This would return, for example, the following date and time formatted resultэто объект отчёта.

Результатом выполнения выражения будет, например: 2013-10-17 09:30:15

Связанные статьи

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@3e4c322
showSpacefalse
sortmodified
reversetrue
typepage
cqllabel in ("dreamreport","tech-note","question","how-to","report","dream","answers") and type = "page" and space = "DRRUS"
labelsdream report dreamreport answers question tech-note how-to

...