Lookup on datasource field

public client static void lookupDummyTable(FormStringControl _ctrl, MyFilterEDT _filter) { // Intantiantes a SysTableLookup object telling it which control activated the lookup, and // what table should be displayed inside the lookup form. SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(DummyTable), _ctrl); Query query = new Query(); // This query will be used by the lookup form. QueryBuildDataSource qbds; ; // The "addLookupField" method adds the the fields that will be shown inside the lookup's grid. // The second, boolean parameter indicates that this field will be returned from the lookup when a // record is selected. In this case, we'll return our DummyPK. sysTableLookup.addLookupField(fieldnum(DummyTable, DummyPK), true); sysTableLookup.addLookupField(fieldnum(DummyTable, Field1)); sysTableLookup.addLookupField(fieldnum(DummyTable, Field2)); sysTableLookup.addLookupField(fieldnum(DummyTable, Field3)); // Using our dummy table as a DataSource Table. qbds = query.addDataSource(tablenum(DummyTable)); // This is the key part, what we want to filter to be displayed in the grid. qbds.addRange(fieldnum(DummyTable, MyFilterColumn)).value(_filter); // Passes the query to the sysTableLookup. sysTableLookup.parmQuery(query); // Activates the lookup. sysTableLookup.performFormLookup(); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.