I need to get the last 10 days orders from 3cart rest API using nodejs. I read the API document but I couldn't figure out how to get the last 10 days orders.
Please give me your suggestions/ideas.
Thanks in advance!
It looks like this is the API call you want, however it does't have a sort or orderby parameter, which means you won't be able to get the last 10 orders.
http://apirest.3dcart.com/Help/Api/GET-3dCartWebAPI-v1-Orders-orderid_invoicenumber_orderstatus_datestart_dateend_limit_offset_countonly_lastupdatestart_lastupdateend
However it does have a count feature, which means there is a way to get the last 10 orders by doing a count of all the rows in the db and skipping them all -10.
example
it counts the orders
[-------------------------] // <-- = 25
the second call we skip the first 15 results and set the limit to 10.
[---------------==========] // <-- we take the last 10 orders
so we want to add the params limit=10,offset=15. The way you offset the results is by doing 25 - 10 or totalCount - 10.
Related
I have an API web http://www.boredapi.com/api/activity/ which randomly creates an activity to do if you are bored. The common output is the activity with the followings fields: key,link,participants,accessibility,price and type.
I'm only interested in showing the activity, the type and the price.
So far so good.
BUT, I wan to be able to get only the activities that are WITHIN a range of prices.
I created the function "fun" and has two parameters (the minimum price and the maximum we are willing to pay.
I want to check in a range from 0 to 10 which activities are available in a specific range of price.
The only thing I can't get around is how to tell the API to print only if the activities are in these ranges...
I tried to access the attribute with ['price'] but it doesn't seem to make any difference.
How would you address this issue?
Currently the output is something like this, the only issue is the price range
import requests
import json
def fun(minprice,maxprice):
for i in range(0,10):
response= requests.get("http://www.boredapi.com/api/activity/")
content_dict=json.loads(response.content)
del(content_dict['key'])
del(content_dict['link'])
del(content_dict['participants'])
del(content_dict['accessibility'])
minprice=content_dict['price']
maxprice=content_dict['price']
print(content_dict)
fun(0,0.1)
Hello from what I understand you are trying to go though each option and check if the price is between two values you can do this by check if the price is between your values like this assuming that content_dict['price'] is a float
if content_dict['price'] > minprice and content_dict['price'] < maxprice:
# whatever you want
I want to search the products data and show the searched data in the below as list up to 15 items if 16 item is entered than automatically the first item will be deleted.can any one help me how to do this in flutter
As you written
when we search the item in the search box it will store in the local db
So you can get only first 15 items using the same query. By that using pagination you can show remaining items. I can't get the use case of removing the top item if there are more than n items in list.
But if you want, you can do this by two ways.
First, putting items one by one in the list. Inside this loop if item count is more than 15 after inserting a new item, just remove the first item
list.removeAt(0);
Second, add the items in array, check for length. If length is greater than 15 get the remaining number & run
list.removeRange(0, );
This will remove the items from top
I am looking for solution how to load items from Azure Easy Tables after 15 on each load in Xamarin.Forms app.
I have tried using:
int number = 15;
Client.GetTable<Class>().Take(number);
number = number + 15;
But it also loads previous items.
Thank you !
By default, the backend returns only the first 50 rows. You can increase the number of returned rows by calling the Take method. Use Take along with the Skip method to request a specific "page" of the total dataset returned by the query.
You could refer to the following code to skips the top 15 items and returns the next 15 items.
int number=15;
int number2=15;
Client.GetTable<Class>().Skip(number).Take(number2);
number=number+15;
For more details, you could refer to this article.
I have a table which is something like this:
Customer ID | Review Flag | Date Received
London Official 27-May-14
London Official 29-May-14
Reginald Official 29-May-14
Reginald Official 29-May-14
Townie Official 05-Jun-14
FHAR_L Unofficial 05-Jun-14
Reginald Official 10-Jun-14
Akmed Official 10-Jun-14
PALNEES Unofficial 11-Jun-14
Akmed Official 11-Jun-14
Woody Official 11-Jun-14
Woody Official 11-Jun-14
Sarah Official 11-Jun-14
I want to count the number of unique official cases over the last 2 weeks. So for example, the result for this particular table would be 5 cases and not 7.
My current implementation is to construct a pivot table, put the customer ID as the row and the value then run a count function on the value column as the ouput. The problem with this is the user needs to go in and change the filters on the pivot table every day, which can get quite confusing because we don't get a case everyday. For example, as some months have 31 days, a situation arises where if we don't receive a case on the 31st then we should not count cases received on the 30th when we are on the 13th of the next month. So ideally, I'd like this solution to be formula-based.
I've read alot about counting uniques in excel but they all seem to be confusing and complicated. Also, they seem to be based off a condition which makes it incompatible with COUNTIFS, which is the function I should use when trying to take into account 'review flag = official' and 'date range = cell1 < x <= cell2'.
Of course, I can do this in VBA but I was wondering if there is a formula-based solution available.
I've worked it out using the SUM(1/COUNTIFS(...)) method of counting unique items in a list.
The formula I got was: =SUM(IF(("Official"=R18:R1000)*(D18:D1000>TODAY()-14),1/COUNTIFS(R18:R100,"Official",C18:C1000,C18:C1000,D18:D1000,">"&TODAY()-14)),0)
Where column names R = review flag, D = date received, C = customer ID, and the dataset starts at row 18.
How I think this works: We have a left hand side array (the IF array) and the right hand side array (the COUNTIFS) array. The COUNTIFS array finds out the number of occurences each binding happens, i.e. at array row[10] it would ask "how many times does the 'Woody, Official, 11-Jun-14' appear together?". The left hand side array looks at which rows match our targetted conditions, returning true or false each row. The SUM function then adds up all the rows in the right hand side array where the left hand side array says that that particular row is TRUE, but as we did 1/ earlier we would get each binding summing up to only 1, thus simulating a unique.
An Important Thing to Remember:
When using array formulas, make sure that all your arrays are of the same size, otherwise you will get an error.
I am trying to create a view to find records of a certain date but the results are not what I want for an end result.
To start I want to view records who's start date is 3 weeks out. Simple enough.
.... StartDate | Next X Weeks | 3
This gets my records that are 3 weeks out cool......but it also returns records that are 1 week and 2 weeks out...which I don't want....but I don't see any way to exclude when working with dates? For example this psuedo query....
.... StartDate | Next X Weeks | 3
.... StartDate | ! Next X Weeks | 2
.... StartDate | ! Next X Weeks | 1
Now I haven't dug into seeing if this can be done by writing FetchXML directly....I figured Msoft would have addressed this by now and incorporated it into the UI...but perhaps I am wrong?
The UI only incorporates a subset of available operators. You could, However, use a dynamically built fetchxml which allows you to use the greater then operator and a specific date (today + 3 weeks).
But this means you need to create your own view using something like the following using a webresource or an iframe.
Well unfortunately this logic isn't capable with FetchXML alone http://msdn.microsoft.com/en-us/library/gg309405.aspx
The "not" concept doesn't apply to dates, otherwise you could use the AND logic you specified above.
You can however create a web resource and then query the data you want via JCL or another library. Then you can parse the results to filter the first two weeks via JavaScript.
Or you can create the view with 3 weeks and sort by the date descending. This leaves extra noise at the end of the view, but may suffice.
I am very grateful to Paul & ad1ka's responses and they definitely taught me something new. However both were not quite what I was looking for and that I'm quite confident that is only because of my poorly worded question.
Here is what I ended up doing and feel free to comment / criticize.
I created a DateConmstants entity and added five records (there will be more). (The records have a name, date, and corresponding view name that it applies to).
I then created a maintenance workflow that executes every night to update the dates. For example record 1 is always to be 2 weeks out so the nightly workflow will update the record with the process exec time + 14 days.
I then created the views needing dates adjusted...(with bogus dates for now)
with OnOrAfter and OnOrBefore thus creating a date "sandwich".
I then created a custom workflow that updates these views. It takes an input array of the views to be updated and the records from dateconstants that match the view.
The workflow then finds the view, loads the fetch into an xml. Using the xml find single node I find the OnorAfter and OnOrBefore values and update them. Then push the xml back to to query definition. Update and publish changes.
Finally this is scheduled as part of the afore mentioned nightly maintenance job.
So every day the users have views displaying the correct records with nothing extraneous.
FWIW