Get value from combo box to text in ax 2009?

Hi,

I creart one form with many tabs. In one tab i create one combo box with many text boxes. if i select any of the value in the combo, that related details should be display in other text boxes. all the fields details contain in one table only include combo box. so no need join query. how to do this in ax 2009.

i need to write code in form, data source or table?? how to achieve this?

Please anyone suggest.

Thanks in advance

How did you filled the combo box? Is it bound to an enum, or what?

(Question moved from Certification and Training Forum.)

Hi martin,

Combo box value displayed from table. combo box field is extended data type

you can write the code in modified method of the combo box control.

get the value from combo box and based on that you can fill other textboxes.

Ex:

public boolean modified()
{
boolean ret;
;

if((combo.valueStr() == “Text”)

{

textbox1.text = “assign values to the textbox based on combo box”

.

.

ret = super();

return ret;
}

Hi Anand,

Thanks for your reply.

Actually that field is EDT and data type is string. Because of EDT relation(which i mentioned), it dispalyed as a combo and also value display from table only.

so i wont mentioned (combo.valueStr() == “Text”) in modified method. it related to table.

Thanks for undersanding.

All right, so the type of field is string, not com box. And what you call combo box is called “lookup” in AX terminology, because it looks up data from another table. Nevertheless it’s irrelevant to your actual problem.

Now the question is what you mean by “should be display in other text boxes”. The easiest way it to bound the other controls to the same field. If they’re fields, do assignment, either in modifiedField() method (if they’re all in the same table and the logic isn’t form specific), or modified() method of the data source field. Access to fields in AX is done through the “dot notation”, e.g. myTableBuffer.MyField. If they’re unbound controls, use the text() method to assign values.

If you gave us enough information, I wouldn’t have to iterate all the options and could use the time the explain your particular case in more details.

Thanks martin

For eg: i have lookup filed : Asset. if select any value, other details wil fetch in related text box. all the field data are in same table only. please look the screen shot below.

Sorry, am not tat much familiar in AX. just learning.

Thanks once again

Okay, I see. So what’s the problem now? You don’t know how to find the asset with the given ID, or what?

yes, if i select any of the asset id that related data will be display in the related text boxes. thats it.

For eg: Asset table have all the fields like model, description,cal interval,received date,range etc…

Thanks

I would add the asset table as the data source and filter it by the given ID.

But you surely can find the record by the find() method or a select statement and fill the fields/controls as explained above.

Hi jaf,

You can use override modified() method :

public boolean modified()

{

boolean ret;

MyTable _MyTable;

ret = super();

select _MyTable where _MyTable.ThaSample== ThaSamplestring.value();

if(_MyTable)

{

Namestring.text( _MyTable.Name);

Hobbystring.text( _MyTable.Hobby);

}

return ret;

}

Thanks a lot Martin.

I find the record using find method. now its working fine.

Thanks a lot Tamim.

your method also Perfectly working.