Announcements
No record found.
Hi ALL,
I have a Reference Group in my grid and I want to set one of the row of this Reference Group as default value in AOT.
Who can help me?
*This post is locked for comments
What do you mean by "in AOT"? In code at runtime? If so, simply assign the right value to the backing field.
Hi Martin,
Yes, in code
I override this lookupReference method in my ReferenceGroup.
public Common lookupReference(){ //FormReferenceControl _formReferenceControl; SysReferenceTableLookup sysTableLookup = SysReferenceTableLookup::newParameters(tableNum(myTable), this);
Query testQuery; QueryBuildDataSource qbds;
QueryBuildRange qbr;
Common selectedRecord;
str test;
// Display the coulmns fields in the lookup form. testQuery= new Query(); //test = strFmt('(%1 == Final)',fieldStr(myTable, ProductTypeID));
//sysTableLookup.addLookupfield(fieldNum(myTable, RecId)); // sysTableLookup.addLookupfield(fieldNum(myTable, ProductTypeName)); sysTableLookup.addLookupfield(fieldNum(myTable, ProductTypeID));
// Create a custom Query qbds = testQuery.addDataSource(tableNum(myTable));
qbds.addRange(fieldnum(myTable, ProductTypeID)).value('Final');
sysTableLookup.parmQuery(testQuery);
selectedRecord = sysTableLookup.performFormLookup();
return sysTableLookup.performFormLookup();
//return sysTableLookup.performFormLookup();}
Aha, so you actually wanted a lookup and not a default value...
I wanted both of them.You know,how I can set default value with code?
thanks
That's what I answered in my first reply. Simply assign a value to the field, e.g. myTable.MyReferenceField = 123456789. (The number is a foreign key, i.e. RecId of the referenced record.)
I didn't do anything more in this thread because I felt that your only question had been answered. You didn't mention any lookup and you didn't say that you didn't understand how to set the default value.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Basit 1
GL-01081504-0 1
Roya 1