User Manual

08.14.2024

MANUAL

FAQ: I want to automatically calculate age from birthdate when registering/updating the edit screen

## Answer This can be achieved with a "「Server Script」". --- ## Overview Enter a birthday and calculate the current age when registering or updating data. Below is a sample in which the current age calculated based on the birthday entered in the "Date A" field is inserted into "Number A". ## How to use 1. Create a "record table". 1. Open the Editor tab from the Table Management in Management and enable "Date A" and "Number A". 1. "Create a new" "「Server Script」" below. For "「Server Script Condition」", select "After formula". ## Sample Code ##### JavaScript ``` function CalculateAge(birthdayVal) { return Math.floor((ConvertDateToNum(new Date()) - ConvertDateToNum(new Date(birthdayVal))) / 10000); } function ConvertDateToNum (date) { return date.getFullYear() * 10000 + (date.getMonth() + 1) * 100 + date.getDate(); } if (utilities.InRange(model.DateA)) { model.NumA = CalculateAge(model.DateA) } else { model.NumA = 0; } ``` ## Related Information <div id="ManualList"> <article class="s-blog_list_unit"><h2> <h2>The specified information was not found.</h2> <p><a href="/ja/manual">Return to top</a></p> </article> </div><input id="SearchTextHidden" type="hidden" value="" />
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.