# Variable expression

expression: {
add_free_variables_to_aggregations: (
freeVars: Set<string>,
aggregations: { [nm: string]: AggregationOptions },
table: Table,
) => void;
add_free_variables_to_joinfields: (
freeVars: Set<string>,
joinFields: JoinFields,
fields: Field[],
) => void;
apply_calculated_fields: (
rows: Row[],
fields: Field[],
ignore_errors?: boolean,
) => Row[];
apply_calculated_fields_stored: (
row: Row,
fields: Field[],
table: Table,
) => Promise<Row>;
eval_expression: (
expression: string,
row?: any,
user?: any,
errorLocation?: string,
) => any;
eval_statements: (
expression: string,
context: GenObj,
errorLocation?: string,
) => Promise<any>;
expressionChecker: (s: string, prefix: string, errors: string[]) => void;
expressionValidator: (s: string) => string | true;
freeVariables: (expression: string) => Set<string>;
freeVariablesInInterpolation: (interpString: string) => Set<string>;
get_async_expression_function: (
expression: string,
fields: Field[],
extraContext?: {},
) => Function;
get_expression_function: (expression: string, fields: Field[]) => Function;
identifiersInCodepage: (s: string) => Set<string>;
jsexprToSQL: (expression: string, extraCtx?: any) => String;
jsexprToWhere: (
expression: string,
extraCtx?: any,
fields?: Field[],
) => Where;
recalculate_for_stored: (table: Table, where?: Where) => Promise<void>;
removeComments: (str: string) => string;
today: (
offset?: number | { startOf: StartOf } | { endOf: StartOf },
) => string;
transform_for_async: (
expression: string,
statefuns: Record<string, PluginFunction>,
) => { expr_string: string; isAsync: boolean };
}

#### Type Declaration

- ##### add_free_variables_to_aggregations: (
  freeVars: Set<string>,
  aggregations: { [nm: string]: AggregationOptions },
  table: Table,
  ) => void

  Add free variables to aggregations

- ##### add_free_variables_to_joinfields: (freeVars: Set<string>, joinFields: JoinFields, fields: Field[]) => void

  Add free variables to join fields

- ##### apply_calculated_fields: (rows: Row[], fields: Field[], ignore_errors?: boolean) => Row[]

- ##### apply_calculated_fields_stored: (row: Row, fields: Field[], table: Table) => Promise<Row>

- ##### eval_expression: (expression: string, row?: any, user?: any, errorLocation?: string) => any

- ##### eval_statements: (expression: string, context: GenObj, errorLocation?: string) => Promise<any>

- ##### expressionChecker: (s: string, prefix: string, errors: string[]) => void

- ##### expressionValidator: (s: string) => string | true

- ##### freeVariables: (expression: string) => Set<string>

- ##### freeVariablesInInterpolation: (interpString: string) => Set<string>

- ##### get_async_expression_function: (expression: string, fields: Field[], extraContext?: {}) => Function

- ##### get_expression_function: (expression: string, fields: Field[]) => Function

- ##### identifiersInCodepage: (s: string) => Set<string>

- ##### jsexprToSQL: (expression: string, extraCtx?: any) => String

- ##### jsexprToWhere: (expression: string, extraCtx?: any, fields?: Field[]) => Where

- ##### recalculate_for_stored: (table: Table, where?: Where) => Promise<void>

  Recalculate calculated columns that are stored in db

- ##### removeComments: (str: string) => string

- ##### today: (offset?: number | { startOf: StartOf } | { endOf: StartOf }) => string

- ##### transform_for_async: (
  expression: string,
  statefuns: Record<string, PluginFunction>,
  ) => { expr_string: string; isAsync: boolean }

- Defined in packages/saltcorn-data/models/expression.ts:999