We need to refresh a block in Oracle Forms, when we applied some filter for query or the data have been changed by the other user. If you just applied a filter or you have a doubt that the data have changed, then use EXECUTE_QUERY method on any button press or any other event. Below is the example:
Refresh Block in Oracle Forms Examples
Begin Go_Block('EMP'); Execute_Query; End;
In the above example, it is setting the focus to EMP block using GO_BLOCK method and then executing the query to populate the data in the EMP block. If the data already been queried before, then it will refresh the data by querying again in Oracle Forms.
If you are updating a data block using any loop and after every iteration, you want to make the updated data visible to the user while loop, then use the Synchronize command. Below is the example:
Begin Go_Block('ABLOCK'); For i in 1..10 loop :ABLOCK.AITEM := i; SYNCHRONIZE; End Loop; End;
In the above example, it will update the item AITEM in ABLOCK with the value of (i) variable and will update/refresh the screen on every iteration using Synchronize command.