In the screen, there is a Block that contains a Form > Table > Input, where the Table's Source is a local list within the Block. I have two questions regarding this setup:
On the initial screen load, the local list in the Block is populated using data retrieved from an Aggregate via ListAppend. The expected behavior is for the data in the local list to be displayed in the Block's Form > Table. However, even though the data is correctly fetched by the Aggregate, the local list sometimes ends up being empty, and the Form > Table in the Block appears blank. This issue doesn't occur 100% of the time. Could you help explain why this happens?
I need to perform custom validations (e.g., database checks, alphanumeric checks) on the input fields in the Block > Form > Table > Input beyond the required field validations. Validation messages should be displayed in the Block's Input fields. However, the Form's Submit button is located in the parent screen, not inside the Block. How can I trigger these custom validations from the parent screen's button and display the corresponding ValidationMessage in the Input fields within the Block?
I also attach a sample application I created.
Hi Somang.
As a remark, you're not transfering data from the block to the page. Event "TransferDetailData" is only being triggered in the OnParameterChanged (which occurs when the webblock input parameters changed, in the parent side). Please check this documentation.
Best Regards,
Miguel
Hi, @Miguel Guerreiro
Thank you for your response.
Assuming that Order and OrderDetail have a 1:N relationship, I believe using an INNER JOIN should not be an issue. In the sample application I attached, this issue does not occur. However, in another application I originally developed, the Aggregate executed during screen initialization fills the local list using ListAppend in the OnAfterFetch event. As a result, the local list ends up empty, leaving the table displaying OrderDetail with no data. I will try to modify the sample application to reproduce this issue.
The "Add Order Product" button inside the block only adds rows to the block's table. It does not update the database; instead, the Save button on the OrderDetail screen triggers the database update. I designed the structure this way to update both Order and OrderDetail data together.
Somang
Hi, @Somang Yun
Please Check the OML i have upload the code as completely.
Question:
1.Mistake in the aggregate join where you are inner join with three table so, if any one of the table is empty then the output will be empty.
2.When you click a save button in parent you want to validate right? Check the Module for that.( Add a input in block when click on save change the value to the block input the OnParameterCahnge will Trigger so add vaildation and trigger a event if vaild then run save action and if not vaild just change the value of the input parameter of the block)
Hi, @nani
I understand what you are trying to achieve in OnParameterChanged. Ultimately, what I want to accomplish is to implement custom validation within the block for each input, in addition to the required field check. For example, I want to verify whether the ProductNo exists in the Product Entity, and if not, display a ValidationMessage. (This is just one example, and I would like to perform other checks as well.)
You can not add a custom validation because the input are inside the table.
But there is other way to accomplish this, create another block and place it inside a table and now you can add custom validation inside a new block.
This will work 100% because pervious I have worked on same requirement where they need a custom validation inside a list.
I hope this will help you.
Please check the oml in pervious reply I have refactored you code.
Hi @Somang Yun,
I have updated your oml file please check.
For the first point - The 'GetOrdersDetails' aggregate currently filters data by order ID. However, when adding a new order, the ID is null (0), resulting in no data retrieval from 'GetOrdersDetails'. Consequently, the 'ListAppend' action in the 'OnAfterFetch' event fails because it is within a loop that requires existing records to append.
For the solution to the first point - I've added a condition in the 'OnAfterFetch' event of the 'GetOrdersDetails' aggregate. If the aggregate returns empty, a blank record is appended to the local list, ensuring at least one visible record on the 'OrderDetail'.
For the solution to the second point - I've applied a fix in the updated .oml file, please review it.
Thanks,
Vipin Yadav
Remove Sum Of SubTotal because it is effected by GroupBy.
In On after Fetch Add Loop to Sum all.
Assgin inside a loop
I have found some extra error in the code which in Action called InputOnChage.
Quantity is always same because you are using current.
Check the OMl file how i am handling the record inside the list with CurrentRowNumber and Index.