setting default value only for visible ,not to be stored

hi,

how can i set a default value in fields from any other tables .while iam using the following code

eg:RouteOpr.SubcontractItem=ProdParametersDim::find(InventDim.inventDimId).Subcontractitem;

the value is stored in the table but my need is the value should not stored but it should be just visible.pls give some idea .

Thanks & Regards

dhinu.v

Hello Dhinu,

If you want some value to be shown on a form or report and not to be stored in a table then you should use a display method for that. To use a display method on a form or report control, the control and the return type of the method must have identical types. For example, if you have a RealEdit control on your form, the display method you are using must return a value of type real.

To add the display method to a form control.

  1. Set the DataSource property for the control to the data source that contains the method.

If you do not set the DataSource property, the system assumes that the method has been defined on the form.

  1. Set the DataMethod property to the name of the method.

Write your display methods on a table so that you can use the same code in several forms or reports. display methods are called each time the form is redrawn. They should not contain complex and time-consuming calculations.

hi,
how can i set a default value in fields from any other tables .while iam using the following code
eg:RouteOpr.SubcontractItem=ProdParametersDim::find(InventDim.inventDimId).Subcontractitem;
the value is stored in the table but my need is the value should not stored but it should be just visible and it will store only when i press the save button.pls give some idea .
Thanks & Regards
dhinu.v

Its new record r old record based on this u write code ?

Hello Dhinu,

Your question is not clear.

  1. First you said that you don’t want to store the values in the table fields and just want to show some values on the form.

  2. Now you are saying that you want to store the values in the table fields only when you press the save button.

You cannot save the field values until you have fields in the table, and this contradicts statement 1.

First make it clear that what is your problem?

HI,

My task is

  1. Default value should be Subcontract Item which will be mapped in the Production Parameter by Site screen

2.Should populate only Service Type of item

In Production Parameter there are three type of item,ITEM,BOM,SERVICE,here we should only save service type of items, but while the form is open it should be loaded with default value, that value should be come as per 1 validation,but it should not saved, only visible, the value will save only when we press save button.

regards

old record sd populate default values from old record ,only for visible not to saved until we press save button

regards

dhinu.v

Hello Dhinu,

To save a field value you need to have fields in Dynamics AX table. It depends on you if you don’t want to save a value in the table field. Please clarify the below points:

  1. On what event (like creation/updation of the record) you want to populate default values in the table fields .?

  2. What you want to achieve by saying that the field values should be saved only when we press Save button. When you press a Save button the table record is validated and if the validation succeeds then the record is saved. But it is not mandatory to press the Save button to save a table record. The question is that suppose you create a new record, populate default values in the corresponding fields, after that you move the focus to some other record. During this the newly created record will be saved and the default values will be stored in the table. I want to ask what you want if a table record is saved by some way other than pressing the Save button?

dear shankar

the problem is to populate the field with a certain value from xxx table

for example, itemId is a field of xxx table in a xxx form ,while open the form this field will displays a value automatically from some other datasource,only display ,not to store it should store when we press save button,else only display

regards

dhinu.v