Hi, I got a table in which one row can contain hand-typed data and another row data will have a copy of values from another table. In my example I got custom (in-memory) table called DPTable1, which has 4 columns as follows:
LogisticsElectronicAddressRecId (existing AX EDT)
LogisticsElectronicAddressLocator (also existing AX EDT)
Description (also existing AX EDT)
SomeOtherStringField (my own EDT)
I created a new form by means of SimpleList wizard, called DPSimpleList, added DPTable1 to data sources of the form and set DataSource property of the grid control. I then added 3 fields on to the grid from my one and only datasource:
DPTable1_LogisticsElectronicAddressLocator
DPTable1_Description
DPTable1_SomeOtherStringField
Here’s how my project looks so far (hope I didn’t forget anything):
On my form I want the user to either populate 3 controls in each row by hand, or use a custom lookup attached to the DPTable1_LogisticsElectronicAddressLocator control, in which case the 2 of the 3 controls in the grid record will be populated for the user from LogisticsElectronicAddress table based on lookup selection.
From here I’m leaving this up with the Gurus of this venue in hope that someone will offer a solution.
Just to bring up other things I’ve tried so far. I’ve googled many posts with various examples for different lookups, but wasn’t able to find just the one that really fits my bill.
In one approach I set Lookup=“Always” property on DPTable1_LogisticsElectronicAddressLocator control and override lookup() method with the following code:
public void lookup()
{
Args args = new Args();
FormRun formLookup;
LogisticsElectronicAddressLookup lookup = LogisticsElectronicAddressLookup::newParameters(this);
lookup.parmMethodType(LogisticsElectronicAddressMethodType::Email);
args.name(formStr(LogisticsElectronicAddressLookup));
args.caller(this);
args.lookupField(fieldNum(LogisticsElectronicAddress, Locator));
args.lookupTable(tableNum(LogisticsElectronicAddress));
args.parmObject(lookup);
formLookup = ClassFactory.formRunClass(args);
formLookup.init();
this.performFormLookup(formLookup);
}
The lookup appears to show up, however from this point on I got no clue how to capture the record LogisticsElectronicAddress table returned from the lookup in order to populate my other controls.
Another post I came across suggested to use reference group and lookupReference() method. For that to work, I had to add a foreign key relation between my temp table and LogisticsElectronicAddress.RecId column; I re-added LogisticsElectronicAddressRecId field to the grid and it was recognized as reference group; added lookup() method to it and, voila, I could surely use the record returned from the lookup to populate my grid record in code. Alas, it did bite me on adding another temp record with hand-typed entries - the form attempted to validate the reference group and complained, despite I set Validate=“No” on the foreign key relation. Thus this approach unfortunately has rendered itself useless, unless I missed something.
Any suggestions would be appreciated.