Skip to main content

clearVar

clearVar

Resets a form variable to the initial value given when it was declared in LucyStudio.

Parameters

  • localVarName (string): A variable name predefined in the LucyStudio form settings

Returns: None (void)

Description

$form.clearVar does not reset the variable to null — it restores the default (initial) value set when the variable was declared in the LucyStudio designer. Internally it calls LucyVarMngr.clearVarValue(_mapFormVar, localVarName).

warning

After clearVar the value is the default defined in LucyStudio, not null. Check the actual value with getVar after resetting.

$form vs $app vs $page

$form.clearVar$app.clearVar$page.clearVar
ScopeCurrent form instanceShared app-wide❌ Not supported
What it resets toThe default declared on the LucyStudio formThe default declared on the LucyStudio app
LifetimeDestroyed when the form closesKept while the app runs

Example

// 카운트 변수를 LucyStudio에서 선언한 초기값으로 복원
$form.clearVar("count");
var restored = $form.getVar("count");
$log.i("초기화 후 카운트:", restored); // LucyStudio에서 선언한 기본값 출력

// 여러 변수 초기화
$form.clearVar("userName");
$form.clearVar("selectedItem");

Related

  • $form.setVar(localVarName, data) — sets a form variable
  • $form.getVar(localVarName) — reads a form variable
  • $app.clearVar(appVarName) — resets an app-wide variable to its initial value