I am trying to get more than 101 rows from a Subform, for doing that, I am open the parent form and search for some value (by building a filter, using setSearchFilter and getRows(1)), right after I got the needed rows in the parent form, I opened SubForm (startSubForm), and with the instance of the subForms I called to getRows(1), getRows(1) return 101 results (rows) instead of 600 results.
How can I retrieve more than 101 results?
There is a limitation of retrieving up to 100 rows from priority when invoking getRows method. However, you can retrieve the rows in bulks by passing the fromRow param.
The definition of getRows according to the API is as followed:
getRows( fromRow, [onSuccess] , [onError] ) ⇒ Promise
When you invoke getRows(1) you will receive the first 100 rows.
You can get the second bulk by passing getRows(101) and so on.
A different option to get all the rows in one go is using REST API which has no limitation on the quantity of returned rows.
Related
I am using tabulator package 4.3.0 to work on a webpage. The table generated by the package is going to be the control element of a few other plots. In order to achieve this, I have been adding a dataFiltered function when defining the table variable. But instead of getting the order of the rows in my data object, I want to figure a way to get the index of the rows in the filtered table.
Currently, I searched the manual a little bit and have written the code analogue to this:
dataFiltered: function(filters,rows){
console.log(rows[0]._row.data)
console.log(rows[0].getPosition(true));
}
But the getPosition always returned -1, which refers to that the row is not found in the filtered table. I also generated a demo to show the real situ when running the function. with this link: https://jsfiddle.net/Binny92/3kbn8zet/53/.
I would really appreciate it if someone could help me explain a little bit of how could I get the real index of the row in the filtered data so that I could update the plot accordingly and why I am always getting -1 when running the code written in this way.
In addition, I wonder whether there is a way to retrieve the data also when the user is sorting the table. It's a pity that code using the following strategy is not working in the way I am expecting since it is not reacting to the sort action and will not show the information when loading the page for the first time.
$('#trialTable').on('change',function(x){console.log("Yes")})
Thank you for your help in advance.
The reason this is happening is because the dataFiltered callback is triggered after the rows are filtered but before they have been laid out on the table, so they wont necessarily be ready by the time you call the getPosition function on them.
You might do better to use the renderComplete callback, which will also handle the scenario when the table is sorted, which would change the row positions.
You could then use the getRows function passing in the value "active" as the first augment return only rows that have passed the filter:
renderComplete: function(){
var rows = table.getRows("active");
console.log(rows[0].getPosition(true));
}
On a side note i notice you are trying to access the _row property to access the row data. By convention underscore properties are considered private in JavaScript and should not be accessed as it can result in unstable system behaviour.
Tabulator has an extensive set of functions on the Row Component to allow you to access anything you need. In the case of accessing a rows data, there is the getData function
var data = row.getData();
I have a domino view with an amount column but some values are empty...and need to be. The problem is that the #Sum works fine until I have an empty value then it stops summing.
eg: if the values are 5,5,"" and 5 I get a sum of 10 and not 15.
I've traced the problem to the #DbLookup which is that it stops building the return array when it encounters a blank value. There is no built in method of dealing with null values.
https://www.ibm.com/support/knowledgecenter/en/SSVRGU_9.0.1/reference/r_wpdr_atfunctions_dblookup_r.html
To make things harder, #dbLookup returns a string if only one is found or an array if more than one are found. If the values are 5,5,"" and 5 it returns an array of 2 values.
var alloc = #Sum(#DbLookup(#DbName(), "SubForms",MainFrmID , "ca_ca_ca_ca_amount"));
if (isNaN(alloc)){
return "$0.00";
}else{
return "$" + alloc.toFixed(2);
}
Can anyone help me refactor the #sum or #DbLookup to allow for empty values? Unfortunately I cannot define any new functions for this solution. The environment is locked down tightly. With a list of values of 5,5,"" and 5 I need a sum of 15.
I would try #Sum(#TextToNumber(#Trim(#Text(#DbLookup(...)))))
I would try
#Sum( #Transform( #Dblookup ( ....
If #DbLookup does not do what you need, you could always iterate over documents or view entries to build the sum.
The flow would be roughly like this:
1. Get a handle to the current database.
2. Get a handle to the "SubForms" view.
3a. Get a view entry collection using using getAllEntriesByKey() with MainFrmID as key, if a view column exists that displays the values you need.
--OR--
3b. Get a document collection using getAllDocumentsByKey() with MainFrmID as key, if no view column exists that displays the values you need.
4. Iterate over the collection to sum up values, using getColumnValues().get(columnNumber) to access the value from each view entry, or getItemValueDouble(fieldName) to access the value from each document.
That way you can easily detect null values and discard them.
I'm using a BIRT report with rather complicated query to get different metrics from multiple tables.
Those metrics are done for data between two dates set as parameter and with different periodicity.
So I don't know how many rows will be in the output.
In the end I get table like this:
Metric A | Metric B | Metric C
2017/01 1 0 4
2017/02 0 3 4
2017/03 1 2 3
In the report design, I need to display it as transposed (metric names are long and there is too many of them).
How can I do it within the report itself?
I think this is more difficult to be done in the query (I don't know how many rows I get in the result - it is dynamically taken from the dates and according to the periodicity).
I tried so far:
Cubes and crosstables - but how can I do it, when I don't know how many columns I get in the end?
Scripting - I can dynamically add more columns or create the table as it is. But how do I get the data from dataset? Here I tried to do something like this:
Firstly, in the dataset onFetch method, I put something in the report variable:
reportContext.setPersistentGlobalVariable("metric_1",row["metric_1"].toString());
Then, in the report beforeFactory, I try to access the variable:
mylabel.setText( reportContext.getPersistentGlobalVariable("metric_1") );
But the result is empty.
Is this a wrong way to do it? Do you have any ideas? I would like to do it in the script - set report data to the globalVariable, then in the beforeFactory access the resultSet and create table for it.
Do you have any other ideas?
P.S. it is very unfortunate that you can't have something like detailColumn (you do have detailRow).
I am making a query to an api which has a limit of displaying 1000 rows / request. I can view more rows by adding a query parameter to the string to see next 1000. But it does not show 2000 rows together
this displays first 1000 rows
http://data.cityofnewyork.us/resource/jfzu-yy6n.json?$limit=1000&$offset=0
and this displays next 1000 rows
http://data.cityofnewyork.us/resource/jfzu-yy6n.json?$limit=1000&$offset=1000
3000 for the next 1000 and so on..
The problem is the next 1000 does not append itself to the previous 1000. Can I write a loop in jquery which would get all of them? Is this doable at all?
just fetch your data , then use append().
however if you want to fetch your data once , then yes it is doable , and you can store data in an array , and append them upon request.
How do I count the number of rows in a jqGrid?
To clarify, there is not much data involved so the grid is pulling all of its data back from the server in a single query, instead of using pagination.
jQuery("#myGrid").jqGrid('getGridParam', 'records');
Update
Note there are two parameters to determine record count:
records
integer
Readonly property. Gives the number of records returned as a result of a query to the server.
reccount
integer
Readonly property. Determines the exact number of rows in the grid. Do not confuse this with records parameter. Although in many cases they may be equal, there are cases where they are not. For example, if you define rowNum to be 15, but the request to the server returns 20 records, the records parameter will be 20, but the reccount parameter will be 15 (the grid you will have 15 records and not 20).
$("#grid").getGridParam("reccount");
Readonly property. Returns integer. Determines the exact number of rows in the grid. (And not the number of records fetched).
More information here.
Here is the code I have so far. It seems like there should be a better way:
jQuery("#myGrid").getDataIDs().length;
How about this?
jQuery("#myGrid tr").length;
Actually, you can take that a step further with the optional context parameter.
jQuery("tr", "#myGrid").length;
Either one will search for every "tr" inside of "#myGrid". However, from my own testing, specifying the context parameter is usually faster.
jQuery("#myGrid").jqGrid('getGridParam', 'records');
You could try:
jQuery("#GridId").jqGrid('getDataIDs');