How to change the value of Option data type field.

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

Welcome to DUG

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

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.

Check the options in field whether first value is blank.

Yes, the first value is blank.

Eg: ,Create,Open,wait…

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

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…

Sagar

If the fields contain some value then what will happen ?

Is that also need to show blank ?

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.