Custom widget - start an analysis and read past data

Is there a way to trigger an analysis from a custom widget in the same manner as a normal input form? Or do we have to use the send data workaround?

Additionally, the custom widget examples provided shows only how to receive data real time. How can we read past data?


Hi @sanimesa,
You need to use the send data in combination with an action by variable to trigger your analysis.
About your second question, can you explain with more details?

@alinetusi Suppose I have a variable and I want to read the last two days data from a custom widget. How do I accomplish this?


Hello @sanimesa
To do this you need to edit the widget by https request using some tool like Insomnia or Postman:
1 - Copy the structure of your widget
Screenshot from 2020-12-04 09-46-55
2 - Paste in the request body
3 - add the amount of data that can come in each variable using the qty variable, you can also use “start_date” and “end_date” to select the data range
Screenshot from 2020-12-04 11-42-18

the request method is the PUT and the url is${dashboar_id}/widget/${widget_id}
change the link with your dashboard and widget id

you also need to add the device token to make the request
Screenshot from 2020-12-04 11-49-10

@gustavo I am not sure I understand this solution.
I want to display past data on a custom widget, not read from an external tool.


yes, to read past data you need to edit the widget using the API: /