Notifications
Announcements
No record found.
I want to add the validation field so that user avoid to type in lookup field and type some garbage value that would not important for me to deal with.
Hi HammadAhmed,
You need to write code in "validateField" method of the table and validate whether the value given in the lookup field.
Just convert the query you have added in the lookup to select statement and validate the lookup field values.
Also if the lookup field has a relation with the other tables - By standard it will give validation if you enter values other then values from the related table.
Thanks,
Girish S.
Hi Hammad,
You can accomplish this by using the validatefield method. Write a select statement to look for the record entered in the field; it will return false if the typed value is not found in the table.
Kindly elaborate it by code
Please see the blog below for sample.
For custome table
www.atnyla.com/.../909
For extension table
ztirom.at/.../
Refer to the below syntax for validateField method.
Public boolean validateField(FieldId _fieldIdToCheck) { boolean ret; ret = super(_fieldIdToCheck); if(_fieldIdToCheck == fieldnum(YourTableName, YourLookupFieldName) { convert the lookup query to standard select statement. if(!bufferName.RecId) //if select statement doesnt return any buffer. { ret = checkFailed("throw warning"); } } return ret; }
I got syntax error
You are missing one more bracket at if condition.
Also where is your select statement for validating records?
if(_fieldIdToCheck == fieldNum(tableName, fieldName))
I didn't understand how to do select statement in this method
You are adding a lookup from the table "Ui_EmployeesDept" and adding range to "operating unit number" field - value should be "00000011".
Now on the table level validate field you need to add the select statement based on the above condition. Like below.
Public boolean validateField(FieldId _fieldIdToCheck) { boolean ret; UI_EmployeesDept employeesDept; ret = super(_fieldIdToCheck); if(_fieldIdToCheck == fieldnum(YourTableName, YourLookupFieldName) { select fisrtOnly * from employeesDept where employeesDept.Name == this.Name && employeesDept.OMOperatingUnitNumber == "00000011"; if(!employeesDept.RecId) //if select statement doesnt return any buffer. { ret = checkFailed("throw warning"); } } return ret; }
Now its givings me syntax error... Why?
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 451 Most Valuable Professional
André Arnaud de Cal... 428 Super User 2025 Season 2
BillurSamdancioglu 239 Most Valuable Professional