Programming Microsoft Dynamics NAV(Fifth Edition)
上QQ阅读APP看书,第一时间看更新

Assigning an InitValue property

Another property we can define for several of the Radio Show fields is InitValue. WDTU has a standard policy that news, sports, and weather be broadcast for a few minutes each at the beginning of every hour in the day. We want the Boolean (Yes/No) fields, News Required, Sports Required, and Weather Required to default to Yes. We also want the default time value of the News Duration, Sports Duration, and Weather Duration to be two minutes, two minutes, and one minute respectpely. That way the first fpe minutes of every hour can be spent on keeping the listeners informed of the latest happenings.

Setting the default for a field to a specific value simply requires setting the InitValue property to the desired value. In the case of the required Boolean fields, that value is set to Yes. Using the Table Designer, we must design the Radio Station table, access the Properties screen for the News Required field. Repeat this for the Sports Required and Weather Required fields. After we have filled in the values for the three fields, exit the Properties screen, exit the Table Designer, and save the changes:

In the case of the Duration fields, we will set the InitValue to two minutes each for News Duration and Sports Duration, and one minute for Weather Duration. Duration fields require both the time span numeric and the time unit of measure (seconds, minutes, hours, and so forth). Our entries will look like 2 minutes (or 2 minute, both are acceptable).