Restfullyii limit and offset - search

Im trying to make use of yii and the restfullyii extension, I have managed to get the search working properly and now Im trying to limit the reults and include an offset, how would i make use of this module and its results, the search returns an array based on a json post, im using a rest controller as well

Yes you can easily set the limit and offset of a request using the _GET vars limit & offset. Here is an example URI:
/api/work?limit=10&offset=30

Related

Encoding Pagination Rules in Azure Data Factory Dataflow Source Options

I'm trying to using pagination rules in the source options for a DataFlow source that is using a DataSet which is using a REST linked service. Pagination works in this particular API where a header w/ a cursor value is returned, and that value is used in the next call's query parameter list: cursor=xxxx. It looks like the API is not having any of this because the cursors that they return aren't URI encoded, and I can't figure out how to set that up encoding in the pagination rule or anywhere else. I would assume that encoding would be automatic, but based on the number of results that I get back using both the ADF DataFlow and Postman, it appears that when I put a non-encoded cursor value in my parameter list, I get an empty result as well as an empty next-cursor header, and that seems to be what is ending the pagination.
So how do I encode URI values, either in the pagination rules of the DataFlow source, the REST DataSet or the REST Linked Service? There doesn't seem to be any available functions for that in the dynamic content option.

FHIR Sorting - How to find out which parameter to pass

Team, I am using FHIR bluebutton for CMS data (Claims data) and
now I want to apply sorting in FHIR data
we are getting bundle of explanation of Benefit(EOB)
https://www.hl7.org/fhir/search.html#sort
I have tried passing date and status params in that _sort
but still not getting sorted data
and I am very much in confusion what to pass as a parameter
suppose I want to sort by ClaimNumber
what to pass, please help and suggest me
You will have to use a search parameter as input for the sorting. For example sorting on last updated date descending would look like this:
GET [base]/ExplanationOfBenefit?_sort=-_lastUpdated
I'm not familiar with which field of ExplanationOfBenefit would hold the ClaimNumber you mention, but if you mean the EOB identifier, the request could be this:
GET [base]/ExplanationOfBenefit?_sort=identifier
If you use the correct syntax, success will still depend on whether the server has implemented sorting on that parameter.

Is it possible to fetch a line item's value with out having to load the whole record?

I'm trying to speed up my ssp application by using nlapiLookupField where possible instead of having to load the whole record and it's sublists using nlapiLoadRecord. Unfortunately it doesn't seem to work with lineitem fields. Is there an api call to fetch a line item's value with out the needing to use nlapiLoadRecord?
I'm using 1.0 as dictated by SCA.
nlapiLookupField() is limited to body fields, however you can use other search apis (eg: nlapiSearchRecord()) to return any information that a saved search can access, which obviously includes item lines. This is particularly useful if you want to read a few fields from a large number of records, but I believe it's performant compared to loading a record even if you just return a single result, say by passing in an internal id as one of the filters. I haven't tested to compare a single result search with a single record load though, so YMMV.
Unfortunately, no. Only body fields are supported with nlapiLookupField or search.lookupFields.

Alfresco webscript (js) and pagination

I have a question about the good way to use pagination with Alfresco.
I know the documentation (https://wiki.alfresco.com/wiki/4.0_JavaScript_API#Search_API)
and I use with success the query part.
I mean by that that I use the parameters maxItems and skipCount and they work the way I want.
This is an example of a query that I am doing :
var paging =
{
maxItems: 100,
skipCount: 0
};
var def =
{
query: "cm:name:test*"
page: paging
};
var results = search.query(def);
The problem is that, if I get the number of results I want (100 for example), I don't know how to get the maxResults of my query (I mean the total amount of result that Alfresco can give me with this query).
And I need this to :
know if there are more results
know how many pages of results are lasting
I'm using a workaround for the first need : I'm doing a query for (maxItems+1), and showing only maxItems. If I have maxItems+1, I know that there are more results. But this doesn't give me the total amount of result.
Do you have any idea ?
With the javascript search object you can't know if there are more items. This javascript object is backed by the class org.alfresco.repo.jscript.Search.java. As you can see the query method only returns the query results without any extra information. Compare it with org.alfresco.repo.links.LinkServiceImpl which gives you results wrapped in PagingResults.
So, as javacript search object doesn't provide hasMoreItems info, you need to perform some workaround, for instance first query without limits to know the total, and then apply pagination as desired.
You can find how many objects have been found by your query simply calling
results.length
paying attention to the fact that usually queries have a configured maximum result set of 1000 entries to save resources.
You can change this value by editing the <alfresco>/tomcat/webapps/alfresco/WEB_INF/classes/alfresco/repository.properties file.
So, but is an alternative to your solution, you can launch a query with no constraints and obtain the real value or the max results configured.
Then you can use this value to devise how many pages are available basing you calculation on the number of results for page.
Then dinamically pass the number of the current page to the builder of your query def and the results variable will contain the corresponding chunk of data.
In this SO post you can find more information about pagination.

OnDemandGrid column sorting isn't working with dstore/Rest and Django Rest Framework

I have created an OnDemandGrid but noticed that the column sorts weren't working on any column. The arrows are there and the screen refreshes, but it won't sort the columns in asc or desc order. I have even tried specifying for each column but it still doesn't work. Anybody having/had the same issue?
UPDATE: 6.16.15 - After trying sortParam suggestion:
Comment below explains. It appears to be doing the right thing... but still won't sort.
UPDATE 6.16.15 - 4:00pm
Apparently ANY type of filtering or sort doesn't work well with Django - trying to determine how set filtering where dojo can communicate to Django Rest or vice versa - so far haven't been able to find a setting on either side that works. Not only does column sort not work - creating a search field doesn't work, nor creating a sort button.
This is after changing to the ORDERING_PARAM in DJANGO settings.py to 'SORT'... for all intensive purposes this looks like it should work.
A quick search through the Django Rest Framework documentation reveals that it defaults to expecting an ordering query parameter to indicate which field should be sorted. The dstore/Request store (inherited by Rest) allows you to indicate the query parameter name that sends sort information, via sortParam.
Additionally, it appears that DRF's OrderingFilter indicates ascending sort with no prefix, and descending sort with -. dstore/Request defaults to expecting + and - as prefixes, but these can be overridden via ascendingPrefix and descendingPrefix.
So in your case, you'll want to include sortParam: 'ordering', ascendingPrefix: '' in the properties passed when you create your Rest store instance.
In general, when you run into store-related issues like this where the grid and backend don't seem to be making ends meet, this is the process you'll have to follow - find out what the server expects, find out what the client-side store implements, and see if it can be tweaked or needs to be customized.
UPDATE 6.17.15 -
Changing server side settings to match dojo/dgrid parameters -
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAdminUser',),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
# 'PAGE_SIZE': 25,
'ORDERING_PARAM': 'sort'

Resources