I'm currently building a Google Data Studio connector where I need to make use of the stepped configuration to achieve dynamic user input.
For example, connecting to Google Analytics will have a configuration of account -> properties -> view.
I want to achieve something exactly of this sort but when a user input the first answer from a dropdown, the connector should make an API request to pull data into the dropdown of the next config.
Please, how do I go about this.
You should be able to get the parameters the user selects from "request.configParams" (in the getConfig function). Using your chosen parameter, you can do an API call to get the data you need so that you can set up your options for the stepped configuration.
Related
Using react-leaflet, I want to get the location address information from coordinates.
I found a working example of a similar behavior: here
However it seems it doesn't work with my version of react-leaflet. Also I don't even need it to work with onClick events, just get the address on page load so i can populate a form field.
Any push in the right direction would be most helpful.
You are looking after a reverse geocoding service. You can start by looking into Nominatim it is free and it is what they use in the example. However remember to read the usage policy, it is not meant for heavy use. If you know that you will make a lot i requests each second you should look for a paid alternative.
Would recommend to build your own service that can take coordinates and pass that to the api, relaying on a package. e.g.
I have a graphql query hook that I pass latLng that I get from leaflet -> pass it through my backend -> Nominatim.
const { data, fetching, error } = useReverseGeo(latLng);
I used strapi as my backend for all my data flow, I created single-type content, this single type has different components attached to it. After configuring all the single-types, I tried to fetch the data through rest Api, But I didn't got the json data as a response.
This is my json response
This is my single-type structure
So to get back all the data from the "single-type" the following procedure are:
After creating the single-Type content, Go to the settings of the strapi admin page and then click the Role option.
Click on the public tab.
locate permissions tab and search for the single-type you created and click on the single-type tab.
Then you will find the permissions for that single-type, tick on find option, there are other option too, tick it as per your needs.
After that you will see a api endpoint on the right side of the screen for that particular single-type.
Copy that endpoint.
Use your browsers or any api client like Postman etc to test the api endpoint.
Now the Main Trick comes here
To get the result of the end point you have to type something like this:
http://localhost:1337/api/"your single-type name"?populate=*
This above code will list all the components and all its data inside of it will be displayed in the json response.
NOTE:
If there is any image data or any other media files inside the component it won't be displayed, so to to get that also along with other data you need to type:
http://localhost:1337/api/"your single-type name"?populate[your component name which contains that image data][populate]=*
When you type the api endpoint url your single-type name should be without double quotes
Follow this link : For More Information regarding how to handle the rest api in strapi
Picture for context
My Community Connector fetches these 2 fields (Subscription Date and Clicks).
I want to be able to filter by date so my table only shows, for example, data from the last 7 days. This works using the Date Filter that Data Studio provides, however, I notice that this date filter does another fetch request with the correct date I selected.
I don't want this to happen. I want to filter by date USING MY EXISTING DATA. Is there any way to do this? To filter only using my cached data, and not send a new GET request?
While this is not doable from Data Studio side, you can implement your own cache in Apps Script. You can evaluate each getData request and return data from the cache if needed. This will avoid sending new GET requests to your API endpoint.
While this may not be the best option to everyone, I found a quick temp solution by loading my own community connector USING google's community connector, Extract Data.
This way my data loads only 1 time, and I can filter it instantly the way I want.
If you want to refresh the data, you 'edit' the data source and save.
My situation: we have a Shopify store, we also have a search engine implemented and hosted on AWS. We need to use that search engine instead of the default /search on our Shopify store.
Ideally, when users try to search something, their query (and potentially some other stuff like attribute selectors/checkboxes on the front end) will be passed to our search engine. Then after the result is back, they will be rendered at the front end.
My Question: how should I do this?
Option 1: modify the theme code, inject some javascript to call the search engine
(Possible, but messy)
Option 2: write an app, wrap my search engine within the app, and somehow plug it in the store
(I don't know how to do this)
Option 3: similar to Option 1, but write an app, use the app to inject some code to the theme, and somehow handle the work.
(I don't know how to do this either)
I found a similar post here: Write custom search app in shopify
but the answers below were more about filtering/modifying search result returned by the default shopify engine, I want to instead use my own search engine.
Essentially my problem was to redirect user search queries to my service, and eventually render search results on user front end. To do that i have found the best way was to write a Shopify App.
Here is my solution:
1, build an App, host it somewhere maybe ngrok, install it on the store: (https://help.shopify.com/api/tutorials)
2, use proxy to redirect the /apps/mysearch to where the App is hosted: (https://help.shopify.com/api/tutorials/application-proxies)
3, in the store, show users a form where action="/apps/mysearch".
4, in the app process the form data, do whatever we want. Eventually return a view back to the store containing the search result, be sure to specify "Content-Type: application/liquid" inside of the app so that the returned view works with shopify theme.
Note that all of the search happens outside of Shopify.
I think you should do this with Option 1. Though its messy but it work and save your time. You can also hire an shopify developer ( like me ) for help.
I am trying to develop a Dojo DataGrid that returns a user's documents from the categorized BidsByDriver view and allows them to edit the Priority field in the grid. After getting past the hurdle of using the keys property to filter over the categoryFilter, this was easy to set up using an xe:viewFileItemService read/write service. However the problem with xe:viewFileItemService as a data source is it will display empty lines for each entry in the view after showing the user's documents in the grid.
To get around the blank lines I went down the path of creating an xe:customRestService that returned the jasonData for just the current user's documents. This fixes my blank lines problem but my data source is not in the correct read/write format to support the in-grid editing.
Here is the resulting Json data returned form the xe:customRestService ...
[{"Driver":"ddd","BidID":"123","Priority":"1","Trip":"644"},
{"Driver":"ddd","BidID":"123","Priority":"2","Trip":"444"},
{"Driver":"ddd","BidID":"123","Priority":"4","Trip":"344"},
{"Driver":"ddd","BidID":"123","Priority":"4","Trip":"643"}
]
Here are the Dojo modules I am loading:
<xp:this.resources>
<xp:dojoModule name="dojo.store.JsonRest"></xp:dojoModule>
<xp:dojoModule name="dojo.data.ObjectStore"></xp:dojoModule>
</xp:this.resources>
And here is the script to develop the data store for the grid:
<xp:scriptBlock id="scriptBlock2">
<xp:this.value><![CDATA[
var jsonStore = new dojo.store.JsonRest({target: "InGridCustom.xsp/pathinfo"});
var dataStore = dojo.data.ObjectStore({objectStore: jsonStore});
]]></xp:this.value>
</xp:scriptBlock>
All of this works very nicely except for the bit on providing the in-grid editing support. Any ideas appreciated.
How are you trying to save the changes? With a custom REST service, I would not expect that saving the data store would make any changes to the back-end data, which is why a refresh would revert it to the original value.
I would expect that you'd need to write a doPost method in your custom REST service to process the change on the server side, along with client-side code to call the post method and pass in the updates to process (along with the document ID).
UPDATED ANSWER:
I would try one or both of these approaches to fix your issue.
1) Have a category in your view, and use a categoryFilter and use the hack to make the service only return the correct values. Outlines in this question: XPages Dojo Grid editable cell does not save value when REST Service save() method is called
2) Change the rest service type to viewJsonService in combination with #1. If you get an error, double check the configuration document that Per mentioned. Also heed Per's comments in the linked question relating to configuration and using Firebug to make sure the correct method is used. The update must be a PUT, a POST will not work with the viewJsonService.
Original Answer (for context of comments)
Paul,
I believe that you need to have a button with code to save the changes back. Maybe you do, but you don't mention it and it isn't in your screen shots. The step that Per mentioned is very necessary so it is good that you have it taken care of. The button is necessary, to 'commit' the changes back. The act of inline editing doesn't trigger the PUT call. If you think about it, you wouldn't want an update after each change but one update when the user is finished editing.
If you don't figure out by this evening, I have working code that I can send you, but don't have access to at work.