Hello,in a class I am creating a simple dialog with a dialogfield such as:
DialogField dialogPurchId = dialog.addField(extendedTypeStr(PurchId));
This shows my purchase order headers in a look up,no problem.However, is there a way to filter this look up? For example I only want to show open orders in this lookup?
Regards
*This post is locked for comments
Jo, you still have references and reference filters on EDT level. They do almost identical job for unbound controls are relations did.
Oh, how I miss relations on EDT level... :-)
Look at class Tutorial_RunbaseForm, it is what are you looking for
Your purchidlookup() method is an instance method (which is correct) - how did you want to call it without creating an instance?
Create an instance of the class where you've defined your lookup method and pass it into the parameter. Trivial.
Hmm I don't have a separate class for generating the dialog, it all gets generated in main method.So I guess I'm gonna have to change it altogether.
Cheers.
Your last parameter is wrong - it needs to be the class where you have implemented your lookup method. It surely isn't the standard dialog class.
If you call registerOverrideMethod() from the object where you've implemented the lookup method, use this as the third parameter.
Try to implement lookup without parameters in same class you create dialog. Form control you can get inside lookup method by calling dialog.formRun().controlCallingMethod().
Hi,
I think the 'redirected' method should have the save number and type of parameters as the original one.
FormStringControl.lookup() doesn't have any parameter.
Maybe you're going to change your declaration and try to access the control using something like element.controlCallingMethod()
only a hint, I do not really know.
regards
Douglas
Cheers;
I have added the following method :
private void purchidlookup(FormStringControl _control)
{
SysTableLookup sysTableLookup;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange querybuildrange;
Query query = new Query();
queryBuildDataSource = query.addDataSource(tablenum(PurchTable));
querybuildrange = queryBuildDataSource.addRange(fieldNum(PurchTable,PurchStatus));
querybuildrange.value(enum2str(PurchStatus::Canceled));
sysTableLookup = SysTableLookup::newParameters(tablenum(PurchTable), _control);
sysTableLookup.addLookupfield(fieldnum(PurchTable, PurchId), true);
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
And to the class, I have added:
control = dialogPurchId.control();
control.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(m_UpdatePurchLinePrices, purchidlookup),dialog);
Yet this gives me an error when i try to open the lookup:
Error executing code: FormStringControl (object), method Lookup called with invalid parameters.
Any ideas?
Sure, it is possible. Implement a custom lookup method (with filters) and link it to your dialog field through DialogField.registerOverrideMethod().
Search internet for examples if needed.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156