При загрузке из источника, меняются данные

Автор andrrreasss, 22 января 2018, 11:33:20

« назад - далее »

andrrreasss

Есть вьюшка с номенклатурой, есть колонка Артикул, тип nvarchar(50). Загружаю в Клик и клик мне почему то меняет значения артикулов. Что странно, добавляет лидирующий 0. Я бы еще понял если бы он обрезал его, хотя там и строка.

Думаю может кэш какой нить в загрузке криво работает. Никто не сталкивался?

Провайдер MS SQL Native при подключении к источнику.


andrrreasss

Так и есть. Алгоритм кэширования считает эти значения одинаковыми. Я поменял сортировку при загрузке и теперь оба значения без 0 впереди.


andrrreasss

В общем это не баг, а фича алгоритма сжатия. Что бы подобного избежать даже текстовые поля надо заворачивать в Text()

admin

Привет, а если использовать convert() в запросе SQL?

andrrreasss

Цитата: admin от 23 января  2018, 07:41:13  
Привет, а если использовать convert() в запросе SQL?

Нет. На выходе из SQL и так строка. Это поведение QS.

The observed behavior is a part of fundamental QlikView functionality and data compression technique.

In short this means that QlikView interprets and associates loaded data by best effort. As part of QlikView optimization and compression technique the same reoccurring value in a field is stored on the first occurrence only, and the following occurrence reference to the first (stored) value. This means that two values with identical numerical representation can not be stored with two different textual presentations in the same field in QlikView.

Please keep in mind that all numerical values in QlikView act as dual values. This means that they have an underlying numerical value that is used for calculations, and a textual formatted value which is the value seen in charts or as calculations results.

In the example below four rows of data are loaded. In the field F1 there are four different value.

Load * Inline [
F1, F2
1,a
01,b
02,c
2,d
];

1.   The first value in F1 is interpreted by QlikView as a numerical 1
2.   The first value is stored as numerical value 1 with textual presentation 1
3.   The second value in F1 is interpreted by QlikView as a numerical 1
4.   There is already a numerical value 1 stored in the field F1, so QlikView associates the second occurrence to the first value. This means that the value 01 will be associated as a numerical 1 with presentation value 1.
5.   The third value in F1 is interpreted by QlikView as a numerical 2
6.   There is no other value stored in the field  F1 as a numerical 2, hence this value is stored as numerical 2 with the textual presentation value 02.
7.   The fourth value in F1 is interpreted by QlikView as a numerical 2
8.   There is already a numerical value 2 stored in the field F1, so QlikView associates the second occurrence to the first value. This means that the value 2 will be associated as a numerical 2 with presentation value 02.
9.   The loaded data will visually not look like the data source. 


F1,F2
1,a
1,b
02,c
02,d

Яндекс.Метрика