Платформа 3V/Отчет/5. Настроить представление, оформление отчета/Настроить сортировку: различия между версиями

Материал из 3v-wiki
Перейти к навигации Перейти к поиску
м (A.saydakova переименовал страницу Содержание/Отчет/Сортировка в Платформа 3V/Отчет/Сортировка поверх перенаправления)
 
(не показаны 4 промежуточные версии 1 участника)
Строка 1: Строка 1:
 +
__NOTOC__
 +
Сортировка - это последовательное расположение элементов. Сортировка в отчете реализуется двумя способами:
 +
# Сортировка по столбцу
 +
# Сортировка по справочнику
  
 +
Исходный справочник:
 +
[[Файл:без сортировки.jpg|500px|безрамки|без]]
 +
<br>
 +
Сортировка по атрибуту "Наименование":
 +
[[Файл:Сортировка в отчете.jpg|500px|безрамки|без]]
 
== Сортировка по столбцу ==
 
== Сортировка по столбцу ==
 +
При сортировке по столбцу данные, по которым происходит сортировка, могут являться как значениями атрибутов справочника или показателя, так и быть расчетными
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Строка 6: Строка 16:
 
|-
 
|-
 
| <syntaxhighlight lang="JSON" line>
 
| <syntaxhighlight lang="JSON" line>
{
+
"view": {
         "column": 9,
+
    ...
 +
    "sortings": [
 +
      {
 +
         "column": 0,
 
         "sortDirection": "Descending",
 
         "sortDirection": "Descending",
 
         "nullsSortingMode": "PlaceLast",
 
         "nullsSortingMode": "PlaceLast",
 
         "discriminator": "PivotColumnSortingDto"
 
         "discriminator": "PivotColumnSortingDto"
 
       }
 
       }
 +
    ]
 +
  ...
 +
  }
 
</syntaxhighlight>
 
</syntaxhighlight>
 
|}
 
|}
Строка 25: Строка 41:
 
|  "nullsSortingMode": "PlaceFirst" / "PlaceLast",|| нулевые в начале / нулевые в конце
 
|  "nullsSortingMode": "PlaceFirst" / "PlaceLast",|| нулевые в начале / нулевые в конце
 
|}
 
|}
 +
 +
=== Пример использования===
 +
Описание кейса и примеры сортировок по различным атрибутам с разными типами данных см. на странице [[Платформа_3V/Справочник/Cортировка|'''Сортировка элементов справочника (SortingOptions)''']]
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px; overflow:auto;">
 +
<div style="font-weight:bold;line-height:1.6;">JSON отчета с сортировкой Договоров по возрастанию по атр."Наименование"</div>
 +
<div class="mw-collapsible-content mw-collapsed-content">
 +
<syntaxhighlight lang="JSON" line>
 +
{
 +
  "workflowId": null,
 +
  "leftHeader": {
 +
    "useLazyDataLoadingStrategy": false,
 +
    "dictionaries": [
 +
      {
 +
        "showDataIfAbsentFilter": null,
 +
        "coordAttribute": null,
 +
        "cartesianOptions": "Default",
 +
        "canSelectAttribute": null,
 +
        "groupingOptions": null,
 +
        "groupingMethod": "Default",
 +
        "sortingOptions": null,
 +
        "rootElement": null,
 +
        "virtualElements": null,
 +
        "displayValueOptions": null,
 +
        "displayAttribute": null,
 +
        "dictionaryId": 84,
 +
        "filter": {
 +
          "value": null,
 +
          "skipIfValueNull": false,
 +
          "attributeId": null,
 +
          "attribute": {
 +
            "id": 1,
 +
            "discriminator": "OwnAttributeDefinitionDto"
 +
          },
 +
          "conditionType": "AllElements",
 +
          "inversion": false,
 +
          "discriminator": "ValueConditionalDictionaryFilterDto"
 +
        },
 +
        "selection": null,
 +
        "hierarchyId": null,
 +
        "limit": null
 +
      }
 +
    ],
 +
    "dictionaryAttributesLinks": [],
 +
    "specialFilters": {
 +
      "filtersByDataOptions": {
 +
        "filtersByData": [],
 +
        "needRestoreFullHierachy": false,
 +
        "joinOption": "Or",
 +
        "restoreElements": null
 +
      },
 +
      "dictionaryAttributesLinks": [],
 +
      "needRestoreFullHierachy": false,
 +
      "restoreElements": null
 +
    },
 +
    "isEditable": false
 +
  },
 +
  "topHeader": {
 +
    "topHeaderItems": [
 +
      {
 +
        "dictionaryAttributes": [
 +
          {
 +
            "dictionaryId": 84,
 +
            "attribute": {
 +
              "id": 2,
 +
              "discriminator": "OwnAttributeDefinitionDto"
 +
            },
 +
            "filter": null,
 +
            "sortingOptions": null,
 +
            "attributeId": null,
 +
            "displayAttributeType": "AttributeName",
 +
            "displayAttributeName": null,
 +
            "addFirstElementValue": false,
 +
            "overwriteNotFirstElementValues": true,
 +
            "delimiter": ", ",
 +
            "hideAttributeNameInHeader": false,
 +
            "headerNameDelimiter": " / ",
 +
            "duplicateValuesForNextDictionaries": true,
 +
            "duplicateValuesForNextRows": true,
 +
            "displayValueOptions": null,
 +
            "linkedAttributeSettings": null,
 +
            "skippedFilterAttributesByLink": [],
 +
            "filterOptionsByLinks": null
 +
          }
 +
        ],
 +
        "settings": null,
 +
        "hyperlinkOptions": null,
 +
        "hasImage": false,
 +
        "columnOptions": null,
 +
        "discriminator": "AttributeHeaderItemDto"
 +
      },
 +
      {
 +
        "dictionaryAttributes": [
 +
          {
 +
            "dictionaryId": 84,
 +
            "attribute": {
 +
              "id": 21,
 +
              "discriminator": "OwnAttributeDefinitionDto"
 +
            },
 +
            "filter": null,
 +
            "sortingOptions": null,
 +
            "attributeId": null,
 +
            "displayAttributeType": "AttributeName",
 +
            "displayAttributeName": null,
 +
            "addFirstElementValue": false,
 +
            "overwriteNotFirstElementValues": true,
 +
            "delimiter": ", ",
 +
            "hideAttributeNameInHeader": false,
 +
            "headerNameDelimiter": " / ",
 +
            "duplicateValuesForNextDictionaries": true,
 +
            "duplicateValuesForNextRows": true,
 +
            "displayValueOptions": null,
 +
            "linkedAttributeSettings": null,
 +
            "skippedFilterAttributesByLink": [],
 +
            "filterOptionsByLinks": null
 +
          }
 +
        ],
 +
        "settings": null,
 +
        "hyperlinkOptions": null,
 +
        "hasImage": false,
 +
        "columnOptions": null,
 +
        "discriminator": "AttributeHeaderItemDto"
 +
      },
 +
      {
 +
        "dictionaryAttributes": [
 +
          {
 +
            "dictionaryId": 84,
 +
            "attribute": {
 +
              "id": 22,
 +
              "discriminator": "OwnAttributeDefinitionDto"
 +
            },
 +
            "filter": null,
 +
            "sortingOptions": null,
 +
            "attributeId": null,
 +
            "displayAttributeType": "AttributeName",
 +
            "displayAttributeName": null,
 +
            "addFirstElementValue": false,
 +
            "overwriteNotFirstElementValues": true,
 +
            "delimiter": ", ",
 +
            "hideAttributeNameInHeader": false,
 +
            "headerNameDelimiter": " / ",
 +
            "duplicateValuesForNextDictionaries": true,
 +
            "duplicateValuesForNextRows": true,
 +
            "displayValueOptions": null,
 +
            "linkedAttributeSettings": null,
 +
            "skippedFilterAttributesByLink": [],
 +
            "filterOptionsByLinks": null
 +
          }
 +
        ],
 +
        "settings": null,
 +
        "hyperlinkOptions": null,
 +
        "hasImage": false,
 +
        "columnOptions": null,
 +
        "discriminator": "AttributeHeaderItemDto"
 +
      },
 +
      {
 +
        "dictionaryAttributes": [
 +
          {
 +
            "dictionaryId": 84,
 +
            "attribute": {
 +
              "id": 23,
 +
              "discriminator": "OwnAttributeDefinitionDto"
 +
            },
 +
            "filter": null,
 +
            "sortingOptions": null,
 +
            "attributeId": null,
 +
            "displayAttributeType": "AttributeName",
 +
            "displayAttributeName": null,
 +
            "addFirstElementValue": false,
 +
            "overwriteNotFirstElementValues": true,
 +
            "delimiter": ", ",
 +
            "hideAttributeNameInHeader": false,
 +
            "headerNameDelimiter": " / ",
 +
            "duplicateValuesForNextDictionaries": true,
 +
            "duplicateValuesForNextRows": true,
 +
            "displayValueOptions": null,
 +
            "linkedAttributeSettings": null,
 +
            "skippedFilterAttributesByLink": [],
 +
            "filterOptionsByLinks": null
 +
          }
 +
        ],
 +
        "settings": null,
 +
        "hyperlinkOptions": null,
 +
        "hasImage": false,
 +
        "columnOptions": null,
 +
        "discriminator": "AttributeHeaderItemDto"
 +
      }
 +
    ],
 +
    "needFilterAttributesByLinks": false,
 +
    "enableFilterByLinks": false,
 +
    "numerationSettings": null,
 +
    "filterOptions": null
 +
  },
 +
  "parameters": [],
 +
  "styles": [],
 +
  "styleOptions": [],
 +
  "stylesTemplate": [],
 +
  "filtersByDataOptions": null,
 +
  "view": {
 +
    "isTopHeaderHidden": false,
 +
    "areRowsColumnsNamesHidden": false,
 +
    "transposeOptions": null,
 +
    "isStylesTemplateEnabled": false,
 +
    "topHeaderStyleId": null,
 +
    "leftHeaderExpandedLevel": 2,
 +
    "fixedColumn": null,
 +
    "pagingOptions": null,
 +
    "emptyValueDisplayString": null,
 +
    "disabledEvents": null,
 +
    "disableVirtualScroll": false,
 +
    "defaultRowPixelHeight": null,
 +
    "gridComponent": null,
 +
    "disableRefreshWhenParameterChanged": false,
 +
    "maxRowsCount": null,
 +
    "sortings": [
 +
      {
 +
        "column": 0,
 +
        "sortDirection": "Descending",
 +
        "nullsSortingMode": "PlaceLast",
 +
        "discriminator": "PivotColumnSortingDto"
 +
      }
 +
    ],
 +
    "buttons": null,
 +
    "filters": null,
 +
    "isReadOnly": false,
 +
    "leftHeaderElementsCount": null
 +
  },
 +
  "externalExecutions": null,
 +
  "settings": null,
 +
  "code": "P_Сортировка по столбцу",
 +
  "id": 86,
 +
  "name": "Сортировка по столбцу"
 +
}
 +
</syntaxhighlight>
 +
</div></div>
  
 
== Сортировка по справочнику ==
 
== Сортировка по справочнику ==
Последовательное расположение в зависимости от выбранного атрибута справочника
+
Основным отличием от сортировки по столбцу является то, что сортировка может производится только по определенным атрибутам справочника, находящегося в строках отчета.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Строка 47: Строка 299:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
|}
 
|}
 +
  
 
{| class="wikitable"
 
{| class="wikitable"
Строка 58: Строка 311:
 
| nullsSortingMode || нулевые значения в начале / в конце ("PlaceFirst" / "PlaceLast")
 
| nullsSortingMode || нулевые значения в начале / в конце ("PlaceFirst" / "PlaceLast")
 
|}
 
|}
 +
 +
=== Пример использования===
 +
Описание кейса и примеры сортировок по различным атрибутам с разными типами данных см. на странице [[Платформа_3V/Справочник/Cортировка|'''Сортировка элементов справочника (SortingOptions)''']]
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="width:800px; overflow:auto;">
 +
<div style="font-weight:bold;line-height:1.6;">JSON отчета с сортировкой Договоров по возрастанию по атр."Наименование"</div>
 +
<div class="mw-collapsible-content mw-collapsed-content">
 +
<syntaxhighlight lang="JSON" line>
 +
{
 +
  "workflowId": null,
 +
  "leftHeader": {
 +
    "useLazyDataLoadingStrategy": false,
 +
    "dictionaries": [
 +
      {
 +
        "showDataIfAbsentFilter": null,
 +
        "coordAttribute": null,
 +
        "cartesianOptions": "Default",
 +
        "canSelectAttribute": null,
 +
        "groupingOptions": null,
 +
        "groupingMethod": "Default",
 +
        "sortingOptions": {
 +
          "attributes": [
 +
            {
 +
              "attribute": {
 +
                "id": 2,
 +
                "discriminator": "OwnAttributeDefinitionDto"
 +
              },
 +
              "sortDirection": "Ascending",
 +
              "nullsSortingMode": "PlaceFirst"
 +
            }
 +
          ]
 +
        },
 +
        "rootElement": null,
 +
        "virtualElements": null,
 +
        "displayValueOptions": null,
 +
        "displayAttribute": null,
 +
        "dictionaryId": 84,
 +
        "filter": {
 +
          "value": null,
 +
          "skipIfValueNull": false,
 +
          "attributeId": null,
 +
          "attribute": {
 +
            "id": 1,
 +
            "discriminator": "OwnAttributeDefinitionDto"
 +
          },
 +
          "conditionType": "AllElements",
 +
          "inversion": false,
 +
          "discriminator": "ValueConditionalDictionaryFilterDto"
 +
        },
 +
        "selection": null,
 +
        "hierarchyId": null,
 +
        "limit": null
 +
      }
 +
    ],
 +
    "dictionaryAttributesLinks": [],
 +
    "specialFilters": {
 +
      "filtersByDataOptions": {
 +
        "filtersByData": [],
 +
        "needRestoreFullHierachy": false,
 +
        "joinOption": "Or",
 +
        "restoreElements": null
 +
      },
 +
      "dictionaryAttributesLinks": [],
 +
      "needRestoreFullHierachy": false,
 +
      "restoreElements": null
 +
    },
 +
    "isEditable": false
 +
  },
 +
  "topHeader": {
 +
    "topHeaderItems": [
 +
      {
 +
        "dictionaryAttributes": [
 +
          {
 +
            "dictionaryId": 84,
 +
            "attribute": {
 +
              "id": 2,
 +
              "discriminator": "OwnAttributeDefinitionDto"
 +
            },
 +
            "filter": null,
 +
            "sortingOptions": null,
 +
            "attributeId": null,
 +
            "displayAttributeType": "AttributeName",
 +
            "displayAttributeName": null,
 +
            "addFirstElementValue": false,
 +
            "overwriteNotFirstElementValues": true,
 +
            "delimiter": ", ",
 +
            "hideAttributeNameInHeader": false,
 +
            "headerNameDelimiter": " / ",
 +
            "duplicateValuesForNextDictionaries": true,
 +
            "duplicateValuesForNextRows": true,
 +
            "displayValueOptions": null,
 +
            "linkedAttributeSettings": null,
 +
            "skippedFilterAttributesByLink": [],
 +
            "filterOptionsByLinks": null
 +
          }
 +
        ],
 +
        "settings": null,
 +
        "hyperlinkOptions": null,
 +
        "hasImage": false,
 +
        "columnOptions": null,
 +
        "discriminator": "AttributeHeaderItemDto"
 +
      },
 +
      {
 +
        "dictionaryAttributes": [
 +
          {
 +
            "dictionaryId": 84,
 +
            "attribute": {
 +
              "id": 21,
 +
              "discriminator": "OwnAttributeDefinitionDto"
 +
            },
 +
            "filter": null,
 +
            "sortingOptions": null,
 +
            "attributeId": null,
 +
            "displayAttributeType": "AttributeName",
 +
            "displayAttributeName": null,
 +
            "addFirstElementValue": false,
 +
            "overwriteNotFirstElementValues": true,
 +
            "delimiter": ", ",
 +
            "hideAttributeNameInHeader": false,
 +
            "headerNameDelimiter": " / ",
 +
            "duplicateValuesForNextDictionaries": true,
 +
            "duplicateValuesForNextRows": true,
 +
            "displayValueOptions": null,
 +
            "linkedAttributeSettings": null,
 +
            "skippedFilterAttributesByLink": [],
 +
            "filterOptionsByLinks": null
 +
          }
 +
        ],
 +
        "settings": null,
 +
        "hyperlinkOptions": null,
 +
        "hasImage": false,
 +
        "columnOptions": null,
 +
        "discriminator": "AttributeHeaderItemDto"
 +
      },
 +
      {
 +
        "dictionaryAttributes": [
 +
          {
 +
            "dictionaryId": 84,
 +
            "attribute": {
 +
              "id": 22,
 +
              "discriminator": "OwnAttributeDefinitionDto"
 +
            },
 +
            "filter": null,
 +
            "sortingOptions": null,
 +
            "attributeId": null,
 +
            "displayAttributeType": "AttributeName",
 +
            "displayAttributeName": null,
 +
            "addFirstElementValue": false,
 +
            "overwriteNotFirstElementValues": true,
 +
            "delimiter": ", ",
 +
            "hideAttributeNameInHeader": false,
 +
            "headerNameDelimiter": " / ",
 +
            "duplicateValuesForNextDictionaries": true,
 +
            "duplicateValuesForNextRows": true,
 +
            "displayValueOptions": null,
 +
            "linkedAttributeSettings": null,
 +
            "skippedFilterAttributesByLink": [],
 +
            "filterOptionsByLinks": null
 +
          }
 +
        ],
 +
        "settings": null,
 +
        "hyperlinkOptions": null,
 +
        "hasImage": false,
 +
        "columnOptions": null,
 +
        "discriminator": "AttributeHeaderItemDto"
 +
      },
 +
      {
 +
        "dictionaryAttributes": [
 +
          {
 +
            "dictionaryId": 84,
 +
            "attribute": {
 +
              "id": 23,
 +
              "discriminator": "OwnAttributeDefinitionDto"
 +
            },
 +
            "filter": null,
 +
            "sortingOptions": null,
 +
            "attributeId": null,
 +
            "displayAttributeType": "AttributeName",
 +
            "displayAttributeName": null,
 +
            "addFirstElementValue": false,
 +
            "overwriteNotFirstElementValues": true,
 +
            "delimiter": ", ",
 +
            "hideAttributeNameInHeader": false,
 +
            "headerNameDelimiter": " / ",
 +
            "duplicateValuesForNextDictionaries": true,
 +
            "duplicateValuesForNextRows": true,
 +
            "displayValueOptions": null,
 +
            "linkedAttributeSettings": null,
 +
            "skippedFilterAttributesByLink": [],
 +
            "filterOptionsByLinks": null
 +
          }
 +
        ],
 +
        "settings": null,
 +
        "hyperlinkOptions": null,
 +
        "hasImage": false,
 +
        "columnOptions": null,
 +
        "discriminator": "AttributeHeaderItemDto"
 +
      }
 +
    ],
 +
    "needFilterAttributesByLinks": false,
 +
    "enableFilterByLinks": false,
 +
    "numerationSettings": null,
 +
    "filterOptions": null
 +
  },
 +
  "parameters": [],
 +
  "styles": [],
 +
  "styleOptions": [],
 +
  "stylesTemplate": [],
 +
  "filtersByDataOptions": null,
 +
  "view": null,
 +
  "externalExecutions": null,
 +
  "settings": null,
 +
  "code": "P_Сортировка по справочнику ",
 +
  "id": 83,
 +
  "name": "Сортировка по справочнику"
 +
}
 +
</syntaxhighlight>
 +
</div></div>
 +
<br>

Текущая версия на 12:05, 29 июня 2021

Сортировка - это последовательное расположение элементов. Сортировка в отчете реализуется двумя способами:

  1. Сортировка по столбцу
  2. Сортировка по справочнику

Исходный справочник:

без сортировки.jpg


Сортировка по атрибуту "Наименование":

Сортировка в отчете.jpg

Сортировка по столбцу

При сортировке по столбцу данные, по которым происходит сортировка, могут являться как значениями атрибутов справочника или показателя, так и быть расчетными

"sortings": [ ]
 1 "view": {
 2     ...
 3     "sortings": [
 4       {
 5         "column": 0,
 6         "sortDirection": "Descending",
 7         "nullsSortingMode": "PlaceLast",
 8         "discriminator": "PivotColumnSortingDto"
 9       }
10     ]
11    ...
12   }
Параметр Описание
"column": 0 нумерация столбцов начинается с 0
"sortDirection": "Descending" / Ascending по убыванию / по возрастанию
"nullsSortingMode": "PlaceFirst" / "PlaceLast", нулевые в начале / нулевые в конце

Пример использования

Описание кейса и примеры сортировок по различным атрибутам с разными типами данных см. на странице Сортировка элементов справочника (SortingOptions)

JSON отчета с сортировкой Договоров по возрастанию по атр."Наименование"

Сортировка по справочнику

Основным отличием от сортировки по столбцу является то, что сортировка может производится только по определенным атрибутам справочника, находящегося в строках отчета.

"sortingOptions": [ ]
 1  "sortingOptions": {
 2         "attributes": [
 3           {
 4             "attribute": {
 5               "id": 1,
 6               "discriminator": "OwnAttributeDefinitionDto"
 7             },
 8             "sortDirection": "Descending",
 9             "nullsSortingMode": "PlaceFirst"
10           }
11         ]
12       }


Значение Описание
attribute описание пути до атрибута, по которому будет производиться сортировка
sortDirection Направление по убыванию / по возрастанию ("Descending" / "Ascending")
nullsSortingMode нулевые значения в начале / в конце ("PlaceFirst" / "PlaceLast")

Пример использования

Описание кейса и примеры сортировок по различным атрибутам с разными типами данных см. на странице Сортировка элементов справочника (SortingOptions)

JSON отчета с сортировкой Договоров по возрастанию по атр."Наименование"