Go to Scriptcase store

# Date Comparison

Special field that allows you to change the functioning of a date type field in the summary filter, enabling the comparison of metrics over time. To use this type of field, it is necessary to have a date type field created, and later change its type to Date Comparison.

> It is only available in the advanced filter and its operation is exclusive to the query summary module.

###### Example of the field in the summary filter

###### Example of the Generated summary

When using the comparison, the summary will be assembled showing the values for the periods informed.

## General Configuration

In this block are the general settings of the field, and where it will be ‘transformed’ into a comparative data field, simply access the settings of a data field and change the Data type to Date comparison

#### Data type of the field.

This attribute defines the type of field in the application. This definition implies the configuration options that will be displayed to the developer as well as the behavior of the field when running the application.

During the application creation process, Scriptcase maps the fields of the table(s) used and defines the data type of the fields according to their SQL type.

For example
Fields of type `varchar` in the table will be defined as `text` in the Data Type attribute.

> It is possible to change the field’s data type, however it is important to take into account the SQLType, displayed in the General Configuration block, to define the field’s data type.

#### Search Label

Defines the column title displayed in the executed application. It can be defined using: Lang, fixed text, or global variable.

###### Lang

Using Lang in the attribute definition is recommended for creating multilingual systems. Langs must be previously defined using the Translate applications option or through the Data Dictionary.

###### Fixed text

In this case, the column title will not be changed due to user interaction, such as changing the application language, for example.

It is a good option for systems created with only one language.

###### Global variable

Using global variables allows you to change the column title according to your system’s business rule.

> We also provide the sc_label macro, which allows you to change the column title regardless of how the label attribute was defined.

##### Example of a column title

#### Use same label used on the Grid

This option, when activated, allows you to use the title of the field defined in the grid, in this case the value defined in the Label filter attribute will be disregarded.

## Value Formatting

#### Regional Settings

Allows you to apply regional date formatting settings to the field, according to the application language. When disabling the use of regional settings, some settings will be displayed such as: Date separator, First Day and Display.

Check below for more details about each configuration option.

> It is possible to change regional settings in general, allowing the use of the option and the same configuration in all your projects, according to the language used. For this configuration, access the Menu Locales > Configurações Regionais

#### Date separator

Defines the character that will be used to visually separate the parts of the date (day, month and year). The characters normally used are: slashes (“/”), hyphens (“-“) and periods (.).

###### Alguns exemplos

- slashes (/): 25/10/2023
- hyphens (-): 25-10-2023
- periods (.): 25.10.2023

> This option will be displayed if the Use regional settings attribute is disabled.

#### First day

Defines the first day of the week to be displayed in the calendar in the date field, for selecting dates.

###### First day change example

In this example, the First day was defined as Monday, changing the order in which the days of the week are displayed in the field calendar.

> This option will be displayed if the Use regional settings attribute is disabled.

#### Display

Defines the date display format by selecting one of the listed formats.

The options are:

- dd-mm-aaaa
- mm-dd-aaaa
- aaaa-mm-dd

> This option will be displayed if the Use regional settings attribute is disabled.

#### View week number

Defines whether the number of weeks will be displayed in the date field calendar.

###### Example of a calendar with number of weeks

## Special Conditions

Defines the special conditions that will be displayed in the date field calendar, see the example below.

###### Example of special conditions in the date field calendar

If no interval is enabled, the calendar in the date field will not have any special conditions.

###### Example of the date field without special conditions

#### Select Values

In this attribute, the special conditions that will be listed as an option in the application must be defined. The predefined intervals are grouped according to the period they refer to. For example, the condition Last week is in the tab Week.

In each of the tabs it is also possible to create personalized intervals using the button Add new range.

In the tab , all selected ranges will be listed, so that the display order can be changed according to the user’s needs.

##### Sorting tab

In this tab, all selected conditions will be listed, allowing the intervals to be reordered according to the system’s needs. You can also remove conditions one by one or using the button Remove all.

##### Add New Range

Clicking on add new range will open a screen with some options for adding new ranges. To add an interval, we must select the type (next or last) and enter the period (value).

For example, adding a range in the year tab, defined Last in the attribute as Type and reporting 2 in the attribute Value a range will be created: Last two years

> This button is available on the Year, Quarter, Month, Week and Day tabs.

##### Type

Defines whether the created interval will refer to a future period (next) or a previous period (last).

- Next - Defines that the created interval will refer to a future date, for example, Next year.
- Last - Defines that the range will refer to a previous date, for example, Last Year.

##### Value

Sets the amount of time for the interval.

> This field only accepts positive integer values greater than zero.

##### Title

Defines the text that will be displayed in the application. When creating a new range, a lang is automatically generated, it is also possible to use a fixed text.

##### Include Current

This option changes how the created interval works, adding the current period to the interval.

For example, adding an interval to the year tab, defining Next in the Type attribute and entering 2 in the Valor attribute and checking the Include current option will create an interval: Next 2 years from current.

## Help Settings

Allow the developer to set up instructions and hints about the field’s use, allowing the developer to help the users about the system usage.

### Description of the settings attributes.

#### Help Description

In this area, you can set up a text that will be shown in the application according to the type of help selected below.

#### Help Type

#### Hint

Display a default icon ? beside the field. When the mouse is above the icon a help text will be displayed.

#### Text

Display a text inside of a `<span></span>` beside the field.

#### Pop-up

Display a default icon ? beside the field. To display the message just click in the icon that a Pop-up will be displayed with the help text.

> The icon displayed when selecting the types Hint or Pop-up vary according to the theme that is being used in the application. This icon can be modified in the CSS Buttons.

#### Tippy

Displays a standard ? icon next to the field. When you hover the mouse over the icon, the message will be displayed in a more user-friendly way.

##### Help type settings (Tippy)

- Help Description : Defines where the field’s help button will be displayed

- Help button position : Defines the display position of the Tippy hint in relation to the field’s help icon

- Time to open hin Tippy : Defines the time in milliseconds for the Tippy hint to be displayed after the mouse passes over the help icon.

- Time to close hin Tippy : Sets the time in milliseconds for the Tippy hint to be hidden after the mouse leaves the help icon.

- Tippy hint width : Sets the width of the Tippy hint in pixels.

#### Help button position (except Tippy)

Allow to set up where the help button will be displayed in the field, there are two options:

Beside: The help icon will be displayed beside the field.
Column: The help icon will be displayed beside the label of the field.