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 | |
|---|---|---|---|
| Scope | Current form instance | Shared app-wide | ❌ Not supported |
| What it resets to | The default declared on the LucyStudio form | The default declared on the LucyStudio app | — |
| Lifetime | Destroyed when the form closes | Kept 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