I am creating a survey and based on the response of the survey i have added a calculated field that calculates a score. Based on the score, the code categorizes the score into three levels of High, Medium and Low. I want to store that categorization in an Application Fact Sheet. I added an option field which can take these three values.
How can I automatically update this option field from the survey? Is it possible to do so?
Hello Shubham,
you can populate the fields used to calculate the score via the Survey.
Once they are populated the calculated field will be filled automatically.
But how do I store the calculate field in the Fact Sheet? How do I map the calculated field in the survey to the created field in Fact Sheet?
Is it through code? or there is a way to do the mapping?
You have to create a field (Single Select field I assume with your scores, as you probably already did)
If Field A, Field B and Field C are used to calculate the Field X (the calculated score),
you will create a Survey asking the values of A,B,C.
People will fill these values and once they are populated they will be used to calculate the final field score in the fact sheet.
You don’t have to ask or add the calculated field in the Survey since it will be filled automatically in the fact sheet once the fields used for its calculation are completed.
Why do you need to map the calculated field in the Survey? I mean you need the data to calculate it you don’t want users to assign a score themselves I suppose.
So if your question is if you need to map it to the Survey just because the values for its calculation are being used in the Survey, you don’t have to.
ok. Understood.
One last question, I am asking three questions in the survey like Technical Fit , Functional Fit and Risk Appetite of the Application. These questions have 5 option choices. How do I save the answers submitted by the respondents in the respective fields of the Fact Sheet?
You just need to add the field to the Survey:

Drag in this option and fill it with the field that you want to match from the dropdown, click next and everything will make sense
Thanks. Will try this way.
Try creating a DEMO Application fact sheet add yourself as a subscriber and do a test run, it will make it much easier this way for you to understand
Ok, I discussed the approach with my team, The complete requirement is that we will be asking approximately 20 questions from the respondents and we dont want to store those responses in the fact sheet. We just want to use the responses to do a calculation in the survey and store the calculated score in the fact sheet from the survey itself. Back to where we started. How can i store the calculated field in the fact sheet?
In order for the calculation feature to work you need to have fact sheet fields so:
either:
- Just use normal questions and add a calculated survey field (which if I remember correctly it’s in JSON format), then important the calculated value into the fact sheet
- Create the fact sheet fields but hide them from users in order to do the calculation
Although I have to say since this is a one of thing and you won’t be needing to calculate the value again (since you don’t want to store the data)
There isn’t really a huge benefit into implementing something like this, maybe just use an excel formula then import the score filed values.
Ok, I think using Calculations will serve my purpose.
The only challenge that I am facing is that when i declare a variable like this , it gives me this error:
Error: Execution errors: Cannot read properties of undefined (reading 'technicallSuitability')
Code:
export function main(data) {
const scoreMap = {
"Very Low": 1,
"Low": 2,
"Medium": 3,
"High": 4,
"Very High": 5
};
const techFit = data.technicalSuitability;
const funcFit = data.functionalSuitability;
const risk = data.aggregatedObsolescenceRisk;
if (!techFit || !funcFit || !risk) {
return null; // Incomplete data
}
const techScore = scoreMapstechFit] || 0;
const funcScore = scoreMapnfuncFit] || 0;
const riskScore = scoreMaporisk] || 0;
const weightedScore = techScore * 0.5 + funcScore * 0.3 + riskScore * 0.2;
if (weightedScore <= 1.5) {
return "L1";
} else if (weightedScore <= 3.5) {
return "M2";
} else {
return "H3";
}
}
Reply
Login to the community
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.