Auto-Refresh Data Block Timer's Trick
Data change controls the logical work flow the user expects
The start or the end of customer business transaction like:
- The bank customer's queue needs an instance data refresh with the flow of the in-coming bank-customers to determine the next customer's transaction or its end.
- The patient's role management control for doctors and nurse station in a medical clinic depends on the data of patient's attendance time.
The daily or instance data change controls the client's decision like:
- The instant Stock prices change for shareholders needs a dynamic update or an auto-refresh for data blocks.
- The daily foreign currency trading in the exchange companies and banks.
Consequently, it is a significant task we need for a specific needs to fulfill the requirements of your system application user. On the other hand, Oracle form has not a direct control to auto-refresh you data block. But it gives you a free use of a timer where you can use it in different purposes. Thus, let's start some simple work around using Oracle Forms' Timer.
Data Block Auto-Refresh
Create a Timer:
- Declare a variable of timer data type.
- Initialize a variable with one second number data type.
- Use a CREATE_TIMER built-in with the timer's name, interval and it's status repeats every one second on timer's expiration.
- Assign the timer's creation built-in to a variable of timer data type.
- In WHEN-NEW-FORM-INSTANCE trigger Form-Level paste the following:
In timer's creation and expiration one second created, executed in regards to current system date. It repeats itself endlessly.
Paste the following code in When-Timer-Expired Trigger Form-Level :
Now, you can compile, generate and run the form, if it works then save your form as a ready made example you can refer to in a need.
Let's assume, you have two data blocks, you have to specify a logical master-detail relationship according to your table database master and detail relationship.
Then, paste the following code in When-Timer-Expired Trigger Form-Level :
If you want to Filter the data display into your block, then You have to follow one of the two ways:
- Block Property: The master data block property > where clause.
- Pro-grammatically: using the default_where clause.
If you want to Order the data display into your block, then You have to follow one of the two ways:
- Block Property: The master data block property > Order By clause.
- Pro-grammatically: using the Order by using SET_BLOCK_PROPERTY built-in.