First Q : I want to add validation before saving records in database but write method doesn't called and records save without getting the error message .
How to make write method called and records doesn't save if getting the errror ?
second Q :
I want to make priority field in table to be an auto increment and show automatic when click on add button so I wrote code on init value () datasource method and made a method on table but it gets the max priority on table not on table in this loan item .
how to fix this ?
write() method isn't the right place for validations. Use validateWrite() instead.
Please create a separate thread for the other question. Thw topic of this one is "Write method not called after click on save button".
By the way, I moved your question to the right forum and change the category to "Development / Customization / SDK".
Hi Menna Allah Ahmed,
For validating records, you can make use of validateWrite method on table or form DataSource level.
For increment of number, you need to get max number and then increment by 1.
Thanks,
Girish S.
For increment of number , I increment by 1 in init value() but it always returns 5 even if no records in this loan item .
For validating records , I write code on validate write but it return the error on record level not on all record .
I want to sum all ratio in grid and throw error if it less than 100 but validate write doesn't make me to add new record to sum all
Seems Loan item is in header table. Your priority field is in Allocation grid, which is a separate table, I guess.
You have added the select statement for getting maximum priority number against the loan item id.
In the header table you have 4 records - So its adding by 1 you are getting 5 as priority number.
Remove the LoanItemId in select statement and check.
For validation the system doesn't know which is the last record and validateWrite method will be called for each line. So, it will check allocation ratio for each line - will throw error at each line if its less then 100 and it will not allow you to create new line.
For increment number , it doesn't work it also returns 5 the max number of priority in allocation table .
there are separate table but it has a relation between them by loan item .
For validation , which method I can write code to validate after enter all records I want ?
I was wrong, your select statement must have LoanItem to get the max priority number. Debug the code and check whether load item id is passed as argument. Also open the table browser and see how may records are there against loan Item in allocation grid table.
As I already said system doesn't know which is the last record - Try adding the code on the leave method of the grid. Better option will be adding validate button on the allocation grid action pane and user have to click the validate button and check.
I will try it , but I want to know the reason of why write method doesn't called ?
Write method is not used for validating records entered. It doesn't have any return type. Write method will call the validateWrite method to validate the records and then the table insertion will happen.
Refer to the below blog for sequence of method calls.
http://axhelper.com/?p=3253
thank you for your effort .
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 Pallavi Phade as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
André Arnaud de Cal... 765 Super User 2025 Season 2
CA Neeraj Kumar 743
Sumit Singh 551