# How to change the value of Option data type field.

**URL:** <https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298>\
**Category:** Developers Forum\
**Created:** [March 6, 2014, 7:51am UTC](https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298 "2014-03-06T07:51:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sagar1415](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@Sagar1415](https://www.dynamicsuser.net/u/Sagar1415)\
**Post date:** [March 6, 2014, 7:51am UTC](https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298/1 "2014-03-06T07:51:32Z")

</div>

In my code i need to change the value of Option data type field everytime the button is clicked.

Also i want to Initialise a default value to this when the Form is opened.

Initvalue in the table for field is not working.

Eg: \_tableNmRec.“Type” := \_tableNmRec.“Type”::Closed; // i want to see this when the form opens.

“Type”:=“Type”::“Closed”; // not working

---

<div class="post-metadata">

**Author:** ![mohana\_cse06](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@mohana\_cse06](https://www.dynamicsuser.net/u/mohana_cse06)\
**Post date:** [March 6, 2014, 7:54am UTC](https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298/2 "2014-03-06T07:54:42Z")

</div>

Welcome to DUG

Where did you write code? What is the SourceTable of form?

---

<div class="post-metadata">

**Author:** ![Sagar1415](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@Sagar1415](https://www.dynamicsuser.net/u/Sagar1415)\
**Post date:** [March 6, 2014, 8:06am UTC](https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298/3 "2014-03-06T08:06:39Z")

</div>

Actually i new in Navision.

i am writing on Form-On Init and on Submit.

Source table has a field of data type Option.

The option strings has some values like ,open,created,wait…

1. I want to see blank on top of dropdown everytime when the form loads

2. Set the value of dropdown as created when the submit button is clicked.

---

<div class="post-metadata">

**Author:** ![amol\_salvi](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@amol\_salvi](https://www.dynamicsuser.net/u/amol_salvi)\
**Post date:** [March 6, 2014, 8:13am UTC](https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298/4 "2014-03-06T08:13:25Z")

</div>

Check the options in field whether first value is blank.

---

<div class="post-metadata">

**Author:** ![Sagar1415](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@Sagar1415](https://www.dynamicsuser.net/u/Sagar1415)\
**Post date:** [March 6, 2014, 9:03am UTC](https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298/5 "2014-03-06T09:03:52Z")

</div>

Yes, the first value is blank.

Eg: ,Create,Open,wait…

---

<div class="post-metadata">

**Author:** ![amol\_salvi](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@amol\_salvi](https://www.dynamicsuser.net/u/amol_salvi)\
**Post date:** [March 6, 2014, 9:16am UTC](https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298/6 "2014-03-06T09:16:44Z")

</div>

On Form you set the SourceTableview property to show the desire type record.so while inserting record type will pickup based on you filter .e.q. Check the Sales order form

---

<div class="post-metadata">

**Author:** ![Sagar1415](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@Sagar1415](https://www.dynamicsuser.net/u/Sagar1415)\
**Post date:** [March 6, 2014, 10:10am UTC](https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298/7 "2014-03-06T10:10:33Z")

</div>

Sorry…but this is not my requirement.

Actually i want to see a top blank value of Option string first time the form is loaded.

Here the dropdown shows the previous selection.

Then subsequently on submit button click, the value keep on changing as per requirement.

Thanks for replying…

---

<div class="post-metadata">

**Author:** ![amol\_salvi](https://avatars.discourse-cdn.com/v4/letter/a/ac91a4/32.png) [@amol\_salvi](https://www.dynamicsuser.net/u/amol_salvi)\
**Post date:** [March 6, 2014, 4:12pm UTC](https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298/8 "2014-03-06T16:12:48Z")

</div>

Sagar

If the fields contain some value then what will happen ?

Is that also need to show blank ?

---

<div class="post-metadata">

**Author:** ![anfinnur](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@anfinnur](https://www.dynamicsuser.net/u/anfinnur)\
**Post date:** [March 10, 2014, 9:19am UTC](https://www.dynamicsuser.net/t/how-to-change-the-value-of-option-data-type-field/51298/9 "2014-03-10T09:19:22Z")

</div>

I think that your approach for this is wrong.

When you state _Type":=“Type”::“Closed”_; in OnInit, the value is set.  
But only until you reach OnAfterGetRecord/OnAfterGetCurrRecord - here the value set in OnInit is replaced by the retrieved record’s value.
