Notifications
Announcements
No record found.
Hi,
I want to set the Lookup that should be a null value in default in a Stringedit Control . I need some Assistance for this. Should we set this property by Code or Manually ? .
Thanks in Advance,
Ram.
You talk about two different things.
A lookup is a form; it doesn't have any value.
A string edit control does have a value and you surely can set it to an empty string (null isn't a valid string value in X++).
Anyway, I think you should explain what you're trying to achieve from user's point of view; then we'll be able to decide what needs to be done technically.
HI Ram,
Do you want to make the Lookup String control appear blank?
How do you set up your form? Is the data source set? If so, clear it first. Then override the lookup () of the string control.
As result: (You do not choose, it is blank)
No, overriding lookup() won't change the value. This method controls how the lookup form is built, when you try to expand the list of possible values.
Hi Martin,
Thanks for your correction.
I agree with what you said, it doesn't change the value.
Is it possible that the data is empty because I cleared the data field of the String control and I override lookup () ,so the value is only displayed in the drop-down list?
-
My code:
public void lookup() { SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(PhoneTable), this); Query query = new Query(); QueryBuildDataSource queryBuildDataSource; ; sysTableLookup.addLookupfield(fieldnum(PhoneTable, NewFieldString2)); queryBuildDataSource = query.addDataSource(tablenum(PhoneTable)); queryBuildDataSource.addSortField(fieldnum(PhoneTable, NewFieldString2)); //queryBuildDataSource.addRange(fieldNum(PhoneTable, NewFieldString2)).value(queryNotValue('')); queryBuildDataSource.orderMode(ordermode::GroupBy); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); super(); }
Yes, clearing the value (setting it to an empty string) of the StringEdit controls is what changes the value displayed in the control. Lookup() method doesn't get execute at all unless you tried to expand the list of values, because what the method does it building the lookup form.
You can easily test by adding a breakpoint to lookup() and attaching the debugger. You'll see at which moment the method executes.
Thank you very much .
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 565 Most Valuable Professional
André Arnaud de Cal... 450 Super User 2025 Season 2
Sohaib Cheema 250 User Group Leader