ajaxLoader:true,
ajaxFiltering:true,
ajaxProgressiveLoad:"scroll",
ajaxProgressiveLoadDelay:200,
ajaxConfig:"POST",
ajaxProgressiveLoadScrollMargin : 10,
I used the above settings and worked in the order below.
clearFilter();
addFilter()
setData()
At this time, 3 requests occur.
One request with no filter applied.
The filter applied has been requested twice.
What's the problem?
That is correct operation of the table. You have Ajax filtering enabled in your settings.
When you clear the filters a request must be made to retrieve the unfiltered data.
Then when you add a filter it must request the filtered data.
Then when you change the data URL with set data it makes another request.
If all you want to do is set a filter then there is no need to call clearFilter then addFilter then setData, you can simply call setFilter which will do all of the above in one action with one request.
table.setFilter("age", "=”, 12);
You only need to call the setData function in this instance if you want to change the base url of the request.
An explanation of this can be found in the first section of the Filter Documentation
Related
I am attempting to Disassociate a reference a contact reference to a single-valued navigation property by setting the value to null.
This works when I call the web api directly:
PATCH https://mydynamics.crm.dynamics.com/api/data/v9.2/contacts(00000000-0000-0000-0000-000000000000)
{ "firstname": "John",
"lastname":"Doe",
"lookup1#odata.bind": null,
"lookup2#odata.bind": null,
"lookup3#odata.bind": null
}
//[...other data omitted for brevity...]
So these lookup fields, lookup 1,2, and 3 would be reset to null (The association is removed).
We run a synchronization program that calls these operations in a batch and when this runs -- using the same payload -- the lookup fields fail to reset (although if I modified firstname or lastname - those fields would update). This is a POST batch call containing just the single PATCH operation in this case but it normally contains multiple operations.
All documentation I can find states that PATCH with multiple operation should be a POST call but it didn't reset my lookups.
If I change the POST batch to a PATCH batch...then it works as expected and all fields are updated correctly including the lookups!
Why the difference between BATCH POST vs PATCH?!
Is is a bug in the API?
Is it because I only had a single operation
in the batch? Would it work for multiple requests? (I didnt try).
Does using PATCH instead of POST have any negative affect on either a
single operation or multiple operations? Suppose a DELETE operation
was also in the batch for something? Microsoft says "Use a POST
request to submit a batch operation that contains multiple requests.
A batch request can include GET requests and change sets."
Why is the
documentation lacking on this topic?
Any help is appreciated!
Read your question while searching for related CRM WEB API challenges.
The response may be a bit overdue but here's what I think applies to your case:
POST, GET, PUT, PATCH, and DELETE are HTTP request types.
When using PATCH on MS CRM you can only edit a single record.
When you want to perform multiple operations at once you use a POST request to post a whole batch of different requests. This can include multiple PATCH requests.
How to POST a batch is described quite okay here:
https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/execute-batch-operations-using-web-api
I am new to jmeter, I am using jmeter to test e-commerce website.
I have manage to script one scenario, which is to add a product in basket and test the response time.
Now, I have observed that when i click Add button on UI, their are two requests which are getting POSTED.
for eg: stocks are updated.
As of now, I have copied the BODY from stock and pasted in jmeter sampler, but in future i may change the Sales order and update scenario, hence i want to store this Body data(Stock request which is updated) of this request dynamically, as it will change corresponding to sales order number im providing.
The problem is I am not able to store the BODY data dynamically(Only if i change the sales order here).
I know i can use pre processor in this matter, but could anyone help me with the code to get the BODY data from the request and store dynamically before sending the sample.
Basically I need a solution where I am just updating my sales order number and rest of the things will be taken care dynamically, in my case the POSTING of Body data for updating the STOCK.
Thank you in advance!
See basically, you're talking about Correlation. As I can understand from your concern. You need the data for the product added to the cart. Which needs data from prev request. This can be easily managed by generating two requests. Extracting from first and using that info for the second one. This will not involve any hardcoding and will work for you in an efficient manner.
Something like:
vars.put('bodyData', sampler.getQueryString())
should do the trick for you, if you put this code into a JSR223 PreProcessor and add this PreProcessor as a child of the HTTP Request sampler which body you need to store - you will be able to access the request body as ${bodyData} later on where required
In the above example:
vars - stands for JMeterVariables class instance
sampler - is for HTTPSamplerProxy
More information: Top 8 JMeter Java Classes You Should Be Using with Groovy
The current Zapier steps i have set up creates a GET request to an external service. that service replies with a list of data that is nested. My end step i need to do is make multiple PUT requests to another API with part of the URL being a value from the response from the GET. There is not a fixed number of id’s/times that it will need to PUT.
Currently if i do it with just the GET then the next step is the PUT it puts all of the values of the ID i need to put at the end of the API url as just a comma separated list. I need them to make separate PUT requests for Each ID.
Any help would be greatly appreciated.
This shows the response to the GET request (Images shows only the first part. There will are more in the response)
This is the PUT request. It currently puts them as a comma separated list. which causes an error. each of the values needs to process as a separate PUT.
You may want to consider writing your own code step to format the nested data into an array of objects (JSON). You could then return the data to output and achieve the effect you're looking for, where the next Step runs a PUT request for each item in your output array.
Here are Zapier's notes on this strategy:
Setting the output to an array of objects will run the subsequent steps multiple times — once for each object in the array. If Code by Zapier is the Zap's trigger and an empty array is returned, nothing happens. You can think of it like a polling trigger that did not get any results in the HTTP response. This functionality is exclusive to triggers — returning an empty array in a Code by Zapier action does not have the same effect.
Im using an ajaxProgressiveLoad="load" successfully, but intialFilter doesnt seem to get applied during the load, as all the rows are displayed. Also, the calculation for the last_page response from the server is quite expensive (and will get more so!) so I was trying to use ajaxURLGenerator to include a last_page=getPageMax() request parameter to tell my server that it has already calculated the last_page already, and just return this value. But getPageMax() returns false, as detailed in the docs to indicate that pagination is not being used.
So at the moment, I'm under the impression that these 2 features/functions are not available under progressiveLoad ? If not, is there another way around to do this ?
Thanks
If you are using progressive loading then i would suggest that you use ajaxFiltering option to pass the filter information back to the server and filter it server side to reduce the amount of data sent in the request.
ajaxFiltering=true
The getPageMax function is only available when pagination is being used explicitly, not when progressive loading is being used
Importantly the last_page value is primarily used in this instance to let Tabulator know that there are still more pages to load, you could effectively always return this value as 1 or 2 above the current page while there is still information available and set it to the current page when you have reached the last set of records, that way it should continue to try and load data without the overhead of the final page calculation.
I have the following layout. If the Export to Excel checkbox is not checked, upon the button being pressed an API call will be made to query the data in the date range, and displayed in d3 graphs below. If it is checked, the button makes the same API call, in addition to referencing a 2nd call that downloads an Excel file. I think these 2 separate calls are necessary because I need the data in both forms (json and an attachment) which both require separate headers. I wasn't able to figure out a way to make just one call and return the data both ways, but if that's possible I would be open to that solution. Otherwise, what are my options to query the data just once, and share it between both calls?
A HTTP request can only respond with one response type. So with a single request you can only return json or excel (whatever encoding you used). When you click that button and the excel checkbox is checked, do you need both responses? Or just the file?
If you just want the file, then ignore the JSON and do not update your d3 graphs.
If you want the graphs and the file, you'll have to make two requests, one for the JSON and one for the file. If you want to only process that DB call once on the server, you'd need something else. Like, return the JSON data and store the file at a link you'll know the address to. Or return the file and push the JSON to the client (WebSocket or similar).
If you can cache on the server (caching DB like redis or in-memory if you can guarantee you'll hit the same server node), you could store/hash the query parameters with the returned data. Any future call would check that cache first and maybe not hit the DB. (Of course, be aware that if any data would update the results, you'll need to kill your cache key so the data is requeried).