`I'm working on a survey using SurveyJS, and I need help configuring a matrix dropdown question. My goal is to set a default value for a specific cell in this matrix.
Problem Description
In my survey, I have a matrix dropdown question where respondents provide information for different categories (Cat 1, Cat 2, Cat 3). Each row represents a category, and the columns include fields like "Base year end," "Base year value," and "Methodological details."
I want to set a default value for the "Base year value" cell specifically in the "Cat 1" row. However, my current approach sets the default value across all rows for the "Base year value" column, which is not what I need.
Current Configuration
Here's the relevant part of my survey's JSON configuration:`
{
"pages": [
{
"name": "performance",
"elements": [
{
"type": "panel",
"name": "7.5Panel",
"elements": [
{
"type": "matrixdropdown",
"name": "1f901b6a-4201-49ee-8169-599c1a8b9f21",
"title": "Provide your base year",
"description": "A meaningful data",
"hideNumber": true,
"columns": [
{
"name": "ed2e7ac8-f1c6-470d-8c57-11da62471247",
"title": "Base year end",
"cellType": "text",
"inputType": "date"
},
{
"name": "51f0a4d0-4713-464c-b913-8d08a0cec24c",
"title": "Base year value",
"cellType": "text",
"useDisplayValuesInDynamicTexts": false,
"placeholder": "decimal places: 3"
}
],
"rows": [
{
"value": "c28454f6-4a7e-4ec7-8882-307a1009b1cb",
"text": "Cat 1"
},
{
"value": "c6a2c79b-c8bf-465d-96ca-cd2467815c5b",
"text": "Cat 2"
}
]
}
]
}
]
}
],
"showQuestionNumbers": "off"
}
Attempted Solution
I tried to set the default value using the defaultValueExpression property in the column definition, but it applied the value to all rows:
{
"name": "51f0a4d0-4713-464c-b913-8d08a0cec24c",
"title": "Base year value",
"cellType": "text",
"useDisplayValuesInDynamicTexts": false,
"defaultValueExpression": "iif({row.c28454f6-4a7e-4ec7-8882-307a1009b1cb} = '', '1000', '')",
"placeholder": "decimal places: 3"
}
`Desired Outcome
I need to set the default value for the "Base year value" cell only in the "Cat 1" row, without affecting the other rows.
Question
How can I configure the JSON to set a default value for the "Base year value" in the "Cat 1" row only?
Any help or guidance on how to achieve this would be greatly appreciated! Thank you!
`
