What's the order returned by getAccountTransactions? - intuit-partner-platform

I was expecting it would return ordered by postedDate, but that does not seem to be case.

Its just the order of retrieval from the website(FI).AggCat service doesn't change that order.
Thanks

Related

Shopify API: How to get id where is greater than

How can I get orders thru Shopify API where the id is greater than xxxxx?
Something like:
admin/api/2020-01/orders.json?id>=1900000000
or
admin/api/2020-01/orders.json?min_id=1900000000
I hope you understand what I mean.
If you read the documentation you see that orders have a created_at_min and created_at_max. Those values are what you use as your filter criteria for dates. If you need to work off of ID then you can try the since_id filter. In other words, give me all order since 123456. You get what I mean?

Group By Grouping Sets Returning Unexpected Result

I have a table on which I'm using Group by Group Sets and it is returning one row of data that I do not understand. I was hope you all could help me make sense of it:
The first row that is returned contains Null for both Balance and WarehouseNo, but I know that the Total Value corresponds to WarehouseNo WW-COI with Balance as Null (see second image proving this).
Why does it appear as null when using Group By Grouping Sets?
I think you have a couple different confusions going on here.
Grouping sets are usually used for getting rid of Union All where you need different groupings on the same table.
In your case, you are keeping your Union All because it is on two different tables.
So, from what it seems, you probably just want to use a normal Group By to keep your groupings linked together. It's not clear to me why you'd need grouping sets here.
Now... to answer your question:
Since you are using grouping sets on this unioned dataset, it is going to do a different grouping for the two sets you provided.
Concurrently, it is going to do a grouping on just WarehouseNo and separately at the same time it is going to do a different grouping of just Balance.
Not seeing your original data, this is probably the reason you are getting Nulls in places you didn't expect.
If you want the two columns to be linked, you would need to include them both in the same set. as in:
Group By Grouping Sets ((WarehouseNo, Balance), (another grouping you may want))
The "other grouping" could well be just (WarehouseNo) or (Balance) or even no grouping (). But only you can decide why that information might be important to you.
So, from the looks of it, you probably just want to use a normal Group By here. But quite possibly I'm missing something that I don't understand about your data and what you are trying to achieve with it.
Hope that helps. :)

GET a resource filtering by a composite key as query parameter?

I'm thinking the best way to create an endpoint that one of the filters be a composite key.
Per example, we have a rest service to search for orders:
/orders/
We can filter the orders by start and final date:
/orders?dt-start=2017-05-11T17:12Z&dt-final=2017-05-11T17:12Z
Until here, so far so good. But I would like to filter the orders by customer. The customer is identified by his type of document and number of this document.
So, something like this could be possible:
/orders?type=ID&number=123456789
But the type and number are query parameters that only work together, it's a composite key. But using query parameter - like the last example - seems that the API user can do too:
/orders?number=123456789
/orders?type=ID
But not makes sense. Yes, I could return an error in response (bad request) if only one of these parameters were passed, but this is not natural for who are reading the API endpoint.
Another strategy is combine type and number in the same parameter, but I never see this in any API.
/orders?document=ID-12345678
It's odd to me too. I prefer to use separated parameters instead of this.
So, there are a way to use query parameter and solve this problem in a more "elegant" way?
Thanks!
Don't make up a composite key, instead conditionally require the two params. This ins't bad and IMO is much cleaner than creating a composite key which isn't represented by the data (or resource).
I've done this before, so to help illustrate I'll point you to it. This resource is to query for CyberFacts. The query is bound by a date range. To get data, you can do one of two things.
You can say ?today=true, and get the data for today (equivalent to saying ?startDate=2017-05-13&endDate=2017-05-13)
You can use the startDate and endDate query parameters, however if you use one and not the other (eg ?startDate=2017-05-13) you will receive a 400 Bad Request status response on the query and a error message in the response body.
So in this case I've done a few things to make this work
Make a higher priority parameter (today overrides startDate and endDate)
Document the valid behaviors
Provide appropriate error responses
For you only #2 and #3 would be needed, I think. Not knowing all of your use cases, I would suggest using /orders?type=ID&number=123456789 and document that number is a require query param when type=ID, and also include the appropriate error (eg: "You queried for an Order by Type 'ID', however you did not provide a 'number' query parameter")
How about providing a default value for type, (such as 'ID') as a fallback if the type parameter is absent (I'd probably go for the most common/used document type depending on your situation).
While for the number parameter I would enforce it, i.e. by specifying that it is a required parameter (somewhere in the docs?). If absent, return a bad request.

sphinxAPI more than one sort method implementation

while fetching records from sphinxApi , i have used the following sort mode. SetSortMode (SPH_SORT_EXTENDED, " field DESC"). Records need to be display randomly. so i have added the below sort method also. SetSortMode(SPH_SORT_EXTENDED, "#random");But records display randomly. But records not display based on first sort method. How to implement two sort methods in single query? Please suggest. Advance thanks
SetSortMode(SPH_SORT_EXTENDED, "field DESC, #random");
(Although I dont know for sure if #random can be combined with others. Extended does support multiple sort orders otherwise)

FOR LAST - Query, giving wrong result

I'm looking to use the following query to find the last tender id.
FOR EACH tender-table NO-LOCK WHERE tender-table.kco = 1 BY tender-table.id:
DISPLAY tender-table.id.
END.
This query looks at all the tender id's and brings back all the results of all the id's in ascending order. The results i get are
1,035
1.036
......
1,060
1,061
1,062
1,063
1,064
1,065
1,066
FOR LAST tender-table NO-LOCK WHERE tender-table.kco = 1 BY tender-table.id:
DISPLAY tender-table.id.
END.
However when i use this query to find the last id, i get the result,
1,061
When I should be seeing the result 1,066. Can anyone suggest why this is happening?
FOR LAST is a very deceptive statement. (So is FOR FIRST.) It does not behave in an intuitive manner. The sort order is NOT specified by the BY statement. You will get the LAST record according to the index which is used and no sorting will take place. When the BY refers to an unindexed field (or one which does not sort in the order of the index actually used) or when the WHERE clause does not obviously map to an index in the order that you are hoping for you will have mysterious records chosen.
Personally, I strongly suggest that you forget about using FOR FIRST & FOR LAST. A better option, which always sorts as expected, would be:
FOR EACH tableName WHERE someCriteria BREAK BY sortOrder:
LEAVE.
END.
DISPLAY whatEver.
(Add "DESCENDING" to flip from FIRST to LAST...)
Just in case anyone needs convincing -- try this with the "sports" database:
for first customer no-lock by discount:
display name discount.
end.
Sorry I have managed to figure it out that the 1,066 values didn't have tender-table.kco = 1. this solves the problem. thanks your time.