Google DataStudio REGEX_EXTRACT json - json

I am trying to create a new field by creating a calculated field and parsing some json in Google DataStudio. However I keep getting an error saying Failed to fetch data from the underlying data set if I use REGEX_EXTRACT
formula I am using:
REGEXP_EXTRACT(json,'(?<="received_at":")(.*?)(?=")')
json string:
{"end_device_ids":{"device_id":"eui-a81758fffe0600cc","application_ids":{"application_id":"3cc54cfd-a809-42e3-89bb-4497ec67fe42"},"dev_eui":"A81758FFFE0600CC","join_eui":"0000000000000000","dev_addr":"260B1B1E"},"correlation_ids":["as:up:01FG833XJCCNBGDDNDYDRV9SRR","gs:conn:01FG16JYQBRKZC3K8HXE6CWK89","gs:up:host:01FG16JZSSC6GWA8TNY733T5GK","gs:uplink:01FG833XBKQGR83P9MTXSEQQHE","ns:uplink:01FG833XBR0NHHAM079T00ZC76","rpc:/ttn.lorawan.v3.GsNs/HandleUplink:01FG833XBR8SJYB9BMX8ZC61YY","rpc:/ttn.lorawan.v3.NsAs/HandleUplink:01FG833XJBN6BQX9HP4MYK51YR"],"received_at":"2021-09-23T01:08:02.252783252Z","uplink_message":{"session_key_id":"AXvkNZkkbAdO+pD5hVSLXg==","f_port":5,"f_cnt":1230,"frm_payload":"AQDoAjwHDjY=","decoded_payload":{"humidity":60,"temperature":23.2,"vdd":3638},"rx_metadata":[{"gateway_ids":{"gateway_id":"iot-stadslab-1","eui":"A84041FFFF1F9951"},"time":"2021-09-23T01:08:06.175212Z","timestamp":2063422380,"rssi":-125,"channel_rssi":-125,"snr":-8.2,"location":{"latitude":51.69522207692182,"longitude":5.293667793175701,"altitude":15,"source":"SOURCE_REGISTRY"},"uplink_token":"ChwKGgoOaW90LXN0YWRzbGFiLTESCKhAQf//H5lREKyn9dcHGgsI8qavigYQroDmECDgr7vshpo1","channel_index":4}],"settings":{"data_rate":{"lora":{"bandwidth":125000,"spreading_factor":10}},"data_rate_index":2,"coding_rate":"4/5","frequency":"867300000","timestamp":2063422380,"time":"2021-09-23T01:08:06.175212Z"},"received_at":"2021-09-23T01:08:02.040299926Z","consumed_airtime":"0.370688s","network_ids":{"net_id":"000013","tenant_id":"ttn","cluster_id":"ttn-eu1"}}}
My regular expression is working as expected inside Regex101. Why is my formula not working? If I try to manually add a column in google sheets using the REGEXEXTRACT(A2, "(?<=\"received_at\":\").*?(?=\")") function I am also getting an error that tells me nothing. Any solution to my problem is appreciated.
Thank you in advance.

Your regex is
=regexextract(A2,"""received_at"":"".*?""")

Related

Hide JsonValue from log file using <flter-spec>

I'am trying to hide the Json value of the student field from log files using filter-spec,
this is my filter-spec :
after i applied the flter this is how the data is showing in the log file
all i want it is to replace ("student" : "testStudent") with ("student": "****") instead it is got replaced with ("student: ****)
does anyone have an example on how to hide the json value using filter-spec?
Thanks in advance
It is not actually possible replace a JSON value with a filter. You'd need to use a custom filter or custom handler in order to do this.
You could file a feature request though. It does seem like a decent idea for a filter to be able to filter values in structured formats.

BigQuery view in a google sheets

I'm trying to get result from BigQuery view in a google sheets.
To do that I'm using a script from Ido Green that he posted on your blog. https://greenido.wordpress.com/2013/12/16/big-query-and-google-spreadsheet-intergration/
It works well for Tables, but I need to extend to query Views.
When I'm using SQL with View I get this error:
GoogleJsonResponseException: Invalid table name: `my_project:Data_Set.1_0_View_all_users_with_domain_names` [Try using standard SQL (https://cloud.google.com/bigquery/docs/reference/standard-sql/enabling-standard-sql)].
If you don't specify otherwise the BigQuery API will default to LegacySQL and you're using StandardSQL notation. You can try setting useLegacySql to false by replacing line 31 to something like:
queryRequest.setQuery(sql).setTimeoutMs(100000).setUseLegacySql(false);

Handling empty rows/cells in JSON - Power BI Querying

Searched everywhere but couldn't find something similar to this.
I got a table as below (a glimpse of it):
customDimensions is the column that pulls the data in JSON format. However, there are some empty cells (as seen below) in the column.
I tried to Parse the whole column into JSON but it is returning me errors in the blank columns as below:
Therefore I tried an alternative way of first replacing those blank cells in the customDimensions to a generic JSON format input as {"Type":"Unhandled"} and then Parsed the column into JSON. This successfully got rid of the errors, but it is returning error while refreshing the data!
So, How do I handle this in a different way? I want to replace those blank cells as either "null" or any keyword, as long as I do not miss the count of those blank cells.
EDIT
Re: This successfully got rid of the errors, but it is returning error while refreshing the data! The error is as follows:
And that specific error is as above
EDIT 2:
Got trapped in the XY Problem but actually you can just replace the error after parsing the JSON instead:
Repeat with all columns and it'll be fine.

Google new spreadsheets return JSON

I am using this link to return JSON data, but it is not working now. It shows a "Invalid query parameter value for grid_id" error. Any ideas? Thanks.
https://spreadsheets.google.com/feeds/list/1fe--KCLag0QNEuYqSeBU2HPZLUoyvicxYfoONnglx-k/821619139/public/values?alt=json
reference link
Google Spreadsheets retrieving JSON feed
Something recently changed in how google assigns the codes for each worksheet. For me, the key was to change the first worksheet from "0" to "od6".
The way to look them up is to use https://spreadsheets.google.com/feeds/worksheets/YOUR-SPREADSHEET_ID_HERE/public/basic. If I do that with your spreadsheet (https://spreadsheets.google.com/feeds/worksheets/1fe--KCLag0QNEuYqSeBU2HPZLUoyvicxYfoONnglx-k/public/basic), I see that the only worksheet id listed is "odl6521" - "821619139" no longer exists. But if I go to https://spreadsheets.google.com/feeds/list/1fe--KCLag0QNEuYqSeBU2HPZLUoyvicxYfoONnglx-k/odl6521/public/values?alt=json , I get out a json file that looks to be what you want.
Hope that helps!

Googlechart error on a linechart with tooltip values coming via JSON

I have a google chart and want to add a custom tooltip. I found some great answers like this this site and set about doing this with roles. I also found this link about it and it looked like the best way.
My data is being generated via json and I use a php file to create a json feed. The rows I have coded like this
{"cols": [ {"id":"","label":"Period","pattern":""},
{"id":"","label":"Recorded P/L","type":"number", "role":"data"} ,
{"id":"","label": null,"type":"string", "role":"tooltip"},
{"id":"","label":"Best Available P/L","type":"number", "role":"data"},
{"id":"","label": null,"type":"string", "role":"tooltip"}
]
Then it goes on and adds all the data. The problem is when I try to run this I get the error
All series on a given axis must be of the same data type
I have checked the json and that is formed correctly but am not sure what I could be doing wrong.
At least part of your problem is that you're not specifying the type for your first column.