# Scope of $variable in Let statement in Calculated Field

**URL:** <https://the.fmsoup.org/t/scope-of-variable-in-let-statement-in-calculated-field/3155>\
**Category:** Questions\
**Tags:** scripting, variables\
**Created:** [October 19, 2022, 6:52pm UTC](https://the.fmsoup.org/t/scope-of-variable-in-let-statement-in-calculated-field/3155 "2022-10-19T18:52:19Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![xochi](https://avatars.discourse-cdn.com/v4/letter/x/0ea827/32.png) [@xochi](https://the.fmsoup.org/u/xochi)\
**Post date:** [October 20, 2022, 1:46pm UTC](https://the.fmsoup.org/t/scope-of-variable-in-let-statement-in-calculated-field/3155/12 "2022-10-20T13:46:54Z")

</div>

This can also happen when using the Data Viewer: [Overriding Variables using the Data Viewer](https://the.fmsoup.org/t/overriding-variables-using-the-data-viewer/2357)

And applies to Custom Functions as well.

hey @MonkeybreadSoftware - would it be possible to create a feature to audit our calc fields and scripts?

> Warning: Table::FIeld is a calculated field which uses $variable names, which could have unexpected side effects. Consider rewriting the calcuation using plain variables instead.

---

_[View the full topic](https://the.fmsoup.org/t/scope-of-variable-in-let-statement-in-calculated-field/3155)._
