Спасибо за схему. К сожалению, я не смог открыть схему в IcCube. Сказали, что схема неисправна. Но просмотр кода очень помог. Я немного изменил javascript, так как была проблема с датами и добавил возможность медленно меняющегося измерения:
В памяти:
Dim1, DimTime, Amount
1,1 Feb 2014,2.4
1,3 Feb 2014,1.4
1,11 Feb 2014,1.4
2,4 Feb 2014,2.4
2,8 Feb 2014,1.4
3,3 Feb 2014,3.4
3,7 Feb 2014,6.4
Код инициализации:
var SCD = "Dim1";
var formerRow = null;
var currentRow = null;
var rowNumber = 0;
var jDateType = Java.type( "org.joda.time.LocalDate" );
var jDateNow = new jDateType();
Строка обработки строки:
currentRow = copy();
set( currentRow, "TO", jDateNow );
if ( formerRow === null) {
// first Line, copy the current row
formerRow = copy();
currentRow = null;
} else if (get(currentRow,SCD) != get(formerRow,SCD)) {
set( formerRow, "TO", jDateNow );
fire(formerRow, rowNumber++);
formerRow = currentRow;
currentRow = null;
} else {
// second Line
set( formerRow, "TO", get(currentRow,"DimTime").plusDays(-1) );
fire(formerRow, rowNumber++);
formerRow = currentRow;
currentRow = null;
}
Код завершения:
fire( formerRow, rowNumber++ );
person
UlrichWuenstel
schedule
04.07.2016