Env: Oracle APEX v5.1.2 with Oracle 12c R2 DB
I have a report that is based off the following table columns in a table called MY_TASK:
TASK_ID (PK),
TASK,
TASK_STATUS (from TASK_CHECKER.task_status)
I also have another table that I use as a running table to check the status of a job that relates to the TASK_ID number from table MY_TASK called TASK_CHECKER which has the columns:
TASK_ID (PK),
TASK_STATUS
Based on the above, I have a scheduled job that regularly checks the status of another table for a specific TASK_ID, which updates the TASK_STATUS value within the TASK_CHECKER table.
Using the above, when the user runs the Oracle APEX app and goes to the MY_TASK report page, I would like through the use of apex.server.process, at startup, join the two tables together via TASK_ID and display the TASK_STATUS at the time within the MY_TASK report.
Please note that the TASK_STATUS values are: WAITING / IN-PROGRESS / SUCCESS or FAILED
So if I had 5 TASK_IDs running, I might see at page load:
1 TASK_A SUCCESS
2 TASK_B ERROR
3 TASK_C IN-PROGRESS
4 TASK_D WAITING
5 TASK_E WAITING
and perhaps 10 seconds later change to:
1 TASK_A SUCCESS
2 TASK_B ERROR
3 TASK_C SUCCESS
4 TASK_D SUCCESS
5 TASK_E IN-PROGRESS
Would like to see TASK_STATUS updates appear in real time.
I just checked and it seems that refresh is async (it doesn't lock the screen). You should be able to do something like this...
setInterval(function() {
apex.region("region_static_id").refresh();
}, 5000);
Just make sure the number of milliseconds is higher than the amount of time the region takes the query to run and the region to render.
Related
I want to paginate the result of my ajax success. In my ajax when I get success I append all result into one table (this table is empty by default only header).
I used this tutorial but I can't figure out how to make it work when the table is empty by default. I was able to make it run when there are values by default.
When the table is populated after ajax success nothing is happening to the data all are displayed. Is there a more applicable sample or tutorial for this kind of scenario. Or what needs to be done on the current tutorial to make it work.
Any suggestion is appreciated
You shouldn't use pagination this way, I suggest you to make your function returning only the records needed for the selected page.
It's useles to make your ajax return all the set (ej. 300 rows) if you are only going to show only a subset (ej. 30 rows in page 1). So you should add to the function which return the records from the DB (lets call it getRecords) a few parameters more:
page: the current/selected page of the paginator
records: how many records you want to show in each page
Combining this two you can limit your sql accordingly, f.instance (you can prepare the limit and the offset before the call in your php code):
select blablabla from blablable where blablablu
limit records, offset (page * records)
note: the first page here is zero. So for the first page the first record will be 0 and the last record shown will be 30 (this is (0 + 1) *30).
Here you have a good tutorial.
I am using sap ui5 oTable for showing the huge data from hana db. While loading the huge data, the browser is going to crash.So I am fetching 100 records from db and showing the 20 records per page.So we can have 5 pagination(5*20=100) with one manual next button. If I click next manual button, I should get next 100 records and pagination should be 6,7,8,9,10.but i could not change the pagination no.
How to change the default pagination number in oTable?
How to achieve lazy loading concept in oTable?
Normally how to achieve the huge data handling in oTable?
Your question is a bit cryptic
Q: If you are asking, why does the odata call only return 100 rows at a time?
The ODataListBinding which populates the table uses the model size limit, which by default is 100, this number is then used in the OData Query populating the $top and $skip query options
eg $top=100 $skip=0
returning the first 100 rows only
Q: How do i change the size limit to bring back more than 100 records
oModel.setSizeLimit(999999)
How can I get the number of rows that will be returned by a sql for a Report Studio report at run time in Javascript? The purpose is to terminate the report as it exceeded the row limitation and notify the user an alert message to re-enter prompts that would reduce the volume of data. Doing so the users will be able to run the report with new prompts without having to re-run the report.
I could find couple of options to limit the maximum rows returned but all they do is terminate the report with an error.
I can suggest another solution. Without Javascript.
Create condition block based on row count.
Add a Query Item with value
Count([Your field]) for report
Add Singleton with your query and this new Query Item.
Set Query property for Page to your main query.
Set Processing property for your main query to "Limited local"
Add Conditional Block with new variable e.g. boolean. Value
[Your query].[Your new field] > 1000
Put you report on a "No" page of conditional block, and a message about row limitation on a "Yes" page.
This solution will work even if you use Excel output.
You can try to add HTML Item to row. Source Type = Report Expression
Put inside
'<script language="javascript">
if ('+number2string (RowNumber ())+'>500){
//Put here code that stops page loading
}
</script>'
But, I don't know how to stop load Cognos page. Usual ways don't work.
You can hide or erase a part of report (whole List), but Cognos load all data anyway.
I am trying to use javascript in my CI view to update (without refresh) a data model every 2 seconds, for my use case where the database contents can be changed by other users.
<script type="text/javascript">
var refreshFunc = setInterval(function() {
<?php
$this -> load -> model('m_cube', '', TRUE);
$stamp = $this -> $m_cube -> stamp();
?>
var stamp = "<?php echo $stamp; ?>";
console.log(stamp);
}, 2000);
refreshFunc;
</script>
I am using JS setInterval to create the 2 second loop, and calling the CI model to retrieve data from the Postgresql database. In the simplified code sample, it's just asking the DB for a timestamp. The problem is that the timestamp written to console doesn't update - something is stuck.
2013-10-21 14:35:54.168-04
2013-10-21 14:35:54.168-04
2013-10-21 14:35:54.168-04
...
Same behavior when querying a table of real data - it doesn't return up-to-date values.
Why does the model access a "frozen" version of the DB?
It's not stuck or "frozen", it's that you had a bit of confusion on what comes before and what after.
I don't see you using AJAX, so by the time your php has been processed (i.e, the data fetched from the db and assigned to $stamp) the page - html, css and javascript too - are yet to be generated and served by the server, nor outputted by the browser.
This means that inside your setInterval you always have the same value, which has been already generated, and thus you keep reprinting the same string.
If you want a continue update, you need to keep requesting the data to the server, and that's where AJAX (Asynchronous JavaScript and XML) can be handy since it runs as a separate request from the main one, so you can work on two different "levels" and fetch content while the rest of the page remains static (already served and outputted).
If you're using jQUery you can look into $.ajax(), which makes this kind of things pretty easy.
When this script runs at the server it fetches the model data and replace the <?php ?> tags with the results. So when it comes to client browser, it doesn't contact server every 2 seconds, but logs the stamp value every 2 seconds. If you want it to be updated you should consider using Ajax technology.
I developed an web application in asp.net. In this application I have used jquery ajax for some pages. In this application, when I make two ajax call asynchronously that would not do as I expected. what is happening is even the second ajax call finishes I can see the result when the maximum time out ajax call finished. I mean I can see the both results in the same time, not one by one.
for an example. I have 3 pages
main.aspx - for make two ajax request.
totalCount.aspx - to find the total count.
(max it takes 7 seconds to return, as corresponding table contains 300k records)
rowCount.aspx - to find the row details. (max it takes 5 seconds to return result).
due to this scene, I have planed to make asyn call in jquery ajax in asp.net.
here is my code:
function getResult() {
getTotalCount();
getRows();
}
// it takes max 7 seconds to complete
// as it take 7 seconds it should display second.( I mean after the rows dispaying)
// but displaying both at the same time after the max time consuming ajax call completed.
function getTotalCount() {
$.ajax({
type : "POST",
async : true,
url : "totalCount.aspx?data1=" + document.getElementById("data").value,
success : function(responseText) {
$("#totalCount").attr("value", responseText);
}
})
}
// it takes max 5 seconds to complete.
// after finished, this should display first.( i mean before total count displays)
// but displaying both at the same time after the max time consuming ajax call completed.
function getRows() {
$.ajax({
type : "POST",
url : "getrows.aspx?data1=" + document.getElementById("data").value,
async : true,
success : function(responseText) {
$("#getRows").attr("value", responseText);
}
});
}
I would like to know, If there is any possible to make asyn call in jquery ajax in asp.net.
I searched in net, I got some points that says we cannot do this in asp.net
ref link: http://www.mail-archive.com/jquery-en#googlegroups.com/msg55125.html
if we can do this in asp.net How to do that?
I'm not a asp.net developer but in general ajax terms I can explain this issue as given below
As ajax stands it is asynchronous, so you to expect the two request in some particular oder will not be wise.
The timings given by will be the time taken by the db server to execute some queries but there are more to the request like network traffic etc, so your assumption that 1 request will return before other is not correct.
The .NET session state will cause all requests for a particular session to be queued up.
If session state is not required, you can disable it.