Christopher Kane

Ramblings of a Software Architect

Recent posts

Tags

Categories

Navigation

Pages

Archive

Blogroll

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Getting values from another table to wire up into a form’s fields

I had to develop a unique situation where a table in axapta needed to be populated using some fields from a newly created table. The problem was that the table ‘ConfigTable’ and it’s associated form allowed the user to enter in information via a textbox/string and we wanted the form to populate this data from another table. We were worried that people won’t do the due diligence to check and see if the ‘ConfigId’ already existed nor would the follow formatting rules. So what we did is was created a new “OwnerMasterTable” table that contained all the unique “ConfigId” and “Name” fields we then changed the form to do a lookup.

We hid the first two fields in the ConfigTable form (ConfigId and Name) and added a new field to the form: OwnerId. Using this field, we were able to lookup the values from the “OwnerMasterTable” and populate the “hidden” values in the form that would then be used to populate the "ConfigTable”. We did it by overwriting the textChange event on the OwnerId so that we could wireup the hidden fields and not break the existing “ConfigTable” schema.

public void textChange()
{
    super();
    // We know what the text is that was selected so lets wire up the configTable's ConfigId value
    configtable.ConfigId = this.text();
    // We need to do a quick lookup of the ownerMasterTable so we can
    // can get the correct Name to wireup to the ConfigTable Name property using the text from above.
    select ownerMasterTable where ownerMasterTable.OwnerId == this.text();
    configtable.Name = ownerMasterTable.Name;
}

Posted: Jul 11 2009, 02:10 by ckane | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Comments

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading