Calculation code to build custom formulas

The following page describes the syntax you can apply when you want to build custom formulas in your report tables. You find the custom formula section here:

Formula Description Example
CellValue(["[ROW-NAME]"],"[COLUMN-NAME]").MissingsCountReturns the count of Interviews with Missings for a specified cell. If the RowName is not specified then the current row is assumed. CellValue(null,"Column1").MissingsCount CellValue("Row1","Column1").MissingsCount
CellValue(["[ROW-NAME]"],"[COLUMN-NAME]").NaCountReturns the count of Interviews with N/A for a specified cell. If the RowName is not specified then the current row is assumed. CellValue(null,"Column1").NaCount CellValue("Row1","Column1").NaCount
CellValue(["[ROW-NAME]"],"[COLUMN-NAME]").ValueReturns the calculated Value for a specified cell. If the RowName is not specified then the current row is assumed. CellValue(null,"Column1").Value CellValue("Row1","Column1").Value
CellValue(["[ROW-NAME]"],"[COLUMN-NAME]").ResponseCountReturns the count of Interviews for a specified cell. If the RowName is not specified then the current row is assumed. CellValue(null,"Column1").ResponseCount CellValue("Row1","Column1").ResponseCount
FormulaDescription
RowResult.MissingsCountReturns the count of Interviews with Missings for the current segment.
RowResult.NaCountReturns the count of Interviews with N/A for the current segment.
RowResult.ResponseCountReturns the count of Interviews for the current segment.
SegmentValue(name)Returns the Segment Value of the current column for the given segment name.
FormulaDescription
DataSourceResult.MissingsCountReturns the count of Interviews with Missings of the whole Table not based on a variable.
DataSourceResult.NaCountReturns the count of Interviews with N/A of the whole Table not based on a variable.
DataSourceResult.ResponseCountReturns the count of Interviews
CurrentRowNameReturns the RowName which is currently calculated
CurrentColumnNameReturns the ColumnName which is currently calculated

Multiline Custom Formula

If you want to create a multi line script, please use the return command in the start and ; in the end:

return (CellValue("Row1","Ginger_1_Average_f2bf-21db").Value 
    + CellValue("Row2","Ginger_1_Average_f2bf-21db").Value 
    + CellValue("Row3","Ginger_1_Average_f2bf-21db").Value 
    + CellValue("Row4","Ginger_1_Average_f2bf-21db").Value 
    + CellValue("Row5","Ginger_1_Average_f2bf-21db").Value) / 5;

The full scope of the script editor is described in the dotnet language reference:

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/
Updated on January 24, 2023

Was this article helpful?

Related Articles

Need Support?
Please login to your Survalyzer account and use the "Create Support Request" form.
Login to Survalyzer