Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ export class Question extends SurveyElement<Question>
}
public get hasFilteredValue(): boolean { return false; }
public getFilteredValue(): any { return this.value; }
public getFilteredName(): any { return this.getValueName(); }
public getFilteredName(): string { return this.getValueName(); }
public get valueForSurvey(): any {
if (!!this.valueToDataCallback) {
return this.valueToDataCallback(this.value);
Expand Down
2 changes: 1 addition & 1 deletion src/question_checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export class QuestionCheckboxModel extends QuestionCheckboxBase {
}
public get selectedItems(): Array<ItemValue> { return this.selectedChoices; }
public get hasFilteredValue(): boolean { return !!this.valuePropertyName; }
public getFilteredName(): any {
public getFilteredName(): string {
let res = super.getFilteredName();
if(this.hasFilteredValue) {
res += "-unwrapped";
Expand Down
32 changes: 16 additions & 16 deletions src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3073,31 +3073,31 @@ export class SurveyModel extends SurveyElementCore
}
return result;
}
getFilteredValues(): any {
var values: { [index: string]: any } = {};
for (var key in this.variablesHash) values[key] = this.variablesHash[key];

getFilteredValues(): Record<string, any> {
const values: { [index: string]: any } = {
...this.variablesHash,

};
this.addCalculatedValuesIntoFilteredValues(values);
var keys = this.getValuesKeys();
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
for (let key of this.getValuesKeys()) {
values[key] = this.getDataValueCore(this.valuesHash, key);
}
this.getAllQuestions().forEach(q => {
if (q.hasFilteredValue) {
values[q.getFilteredName()] = q.getFilteredValue();
for (let question of this.getAllQuestions()) {
if (question.hasFilteredValue) {
values[question.getFilteredName()] = question.getFilteredValue();
}
});

}
return values;
}
private addCalculatedValuesIntoFilteredValues(values: {
[index: string]: any,
[index: string]: CalculatedValue["value"],
}) {
var caclValues = this.calculatedValues;
for (var i = 0; i < caclValues.length; i++)
values[caclValues[i].name] = caclValues[i].value;
for (let calculatedValue of this.calculatedValues) {
values[calculatedValue.name] = calculatedValue.value;
}
}
getFilteredProperties(): any {
getFilteredProperties(): { survey: SurveyModel } {
return { survey: this };
}
private getValuesKeys(): Array<string> {
Expand Down