Bring extra field from lookup

Hello guys,

I have a lookup called VendAccount on my form.Vendaccount lookup has 2 fields like VendAccountId and Name.

and also I have to put a field name field on my form but it must come from the vendaccount lookup automatically.When I add value on vendaccount lookup,name field must fill from the this lookup auto.

I should write a display but HOW can I bring the name values from the lookup field?

I think the best option is changing your design and using a reference group control, if you can change the field.

thank you for your answer but how can I update the field after the select the lookup field.They want to update the field automatically when I select the lookup field.

Does that mean updating the Name field after selecting the vendor id?

yes exactly vendaccountid id lookup field ,I have to update name field from this lookup after I chose it

You can have your code in modifiedField method in the table.

how can I use modifield method like this:when field x(lookup) changes, fill field y like that.

You are not changing the lookup. A lookup allows you to select a field value. That means you are modifying or updating a field value. So the modified field on table will be called.
Have a look at PurchTable.modifiedField method. Most of the tables will have that method. You can look them for reference.

You didn’t get my suggestion. There would be no extra field and no code to write, you would simply configure the reference group to replace the key with two fields.

I tried actually but I did something wrong.I created referance group on grid.and then I write referencefield BuzcrdtId,Replementfieldgrup for BuzBankcrdtId. I am trying to when I select buzCrdtId,BuzBankcrdtId must come from BuzcrdtId.Both of these look up.

this is my table’s modifield method:
I am trying to fill BuzBankcrdtId from BuzCrdtId field.
Could you check the code ,this is not updating buzBankcrdtId field fromBuzcrdtId obiviously.

BuzBankCrdtId BuzBankCrdtId;
//BuzCrdtTable BuzCrdtTable;
//BuzCrdtId BuzCrdtId;
//
//;
//super(_fieldId);
//switch (_fieldId)
//{

//case fieldnum(BuzProformaInvoiceTable,BuzCrdtId):
//while select BuzCrdtId from BuzCrdtTable where BuzCrdtTable.BuzCrdtId == this.BuzCrdtId && BuzCrdtTable.BuzBankCrdtId ==this.BuzBankCrdtId
//{
//ttsBegin;
//this.BuzBankCrdtId=BuzCrdttable.BuzBankCrdtId;
//this.doUpdate();
//ttsCommit;
//}
//
//
//break;
//}

You don’t have to call an update on current buffer. Try below. See if you have a find method on BuzCrdtTable table. So that you can use it (instead of select)
case fieldnum(BuzProformaInvoiceTable,BuzCrdtId):
select firstonly BuzBankCrdtId from BuzCrdtTable where BuzCrdtTable.BuzCrdtId == this.BuzCrdtId;
this.BuzBankCrdtId=BuzCrdttable.BuzBankCrdtId;
break;

thank you so much kranthi all of your helps.You are really a good teacher:)İt worked.It was so easy actually but I made it so complicated.

.