Great Job! Would be great if you did a tutorial on how you did this.
Sure thing. I’ll make one tonight.
Now, I can give a second try to that weather app that I started a long time ago.
Haha that was a long time ago my friend.
You were the one behind the scripts. Without you, I don’t think I’d have started that app at all.
@Robert_Petitto I really need to find some time to sit down and play with all of this, but it looks like jq query may be able to pull back multiple values at once. From what I see with your setup, you are making three separate api calls, which works, but could be better if it was a single call. I wonder if you can specify all values and have them returned in a delimited list, which could be split into an array and separated out with single value columns. That’s the hard way…on the other hand, you could retrieve the entire json object and use David’s json transformation column (Jq (JSON transformation) Column) to get the values you need. Either way, it would reduce three api calls down to one…especially if there are limits on how many calls you can make within a given time period.
This is what I did yesterday.
I use David’s column to retrieve the Json then use Single Values and Split columns to get the info I needed.
The only thing with splitting it that way is that JSON doesn’t necessarily need to be structured with everything in a certain order. I mean, the hierarchy matters, but the order of items within a node could be in any order because each piece of data is qualified by name. If the json layout is stable, then you are pretty safe assuming the positions of each piece of data, but I wouldn’t assume that, as a json object could be updated in the future to include or exclude data. The only difference to what I was pointing out to Robert, is that jq query lets you specify which one (or possibly more) parts of the object you need. David’s other JSON Transformation column also lets you specify which parts you need, so you don’t have to rely on the structure of the JSON object always being the same. You just directly specify what you need out of that object and it will be returned, without relying on positions of everything in the json string.
Thanks for pointing that out.
I will check out the other column and work on a better solution!!!
Awesome! Even better that you can join multiple together! Probably a negligible speed improvement unless the api takes a long time to run on the remote server, but definitely reduces the load of having to run it multiple times.
Wow! Did not know you could do that.
Right but I would try to return an array with all values and later using Single Value columns, choose and show the wished values reading the item position in array. This will apply in cases where I want to retrieve more than 4-5 values from JSON payload.
But, we have to modify/improve the David’s column/script to get an array.
Nice to see these ideas over here!.
David’s JSON Transform column would do that. You pull in the entire JSON string which contains all of the values, and then pick out what you need using the transform column, just like you can with an array and single value columns. The JSON Transform is a lot safer since you don’t need to assume the position of data in the JSON strings. Instead it queries it like an object, as opposed to reading through it like an array. You can still perform a single api call to get the entire json, but have as many transform columns as you need to parse out the data you need.
Yes!.. thinking it better, one can put several values separated by comma or slash and get an array using a Split Text column later:
..lat + "/" + ..lon + "/" + ..temp + "/" + ..temp + "/" + ..cityname
Ahh, I see what you’re saying. Yeah, that would work pretty good. You still have control over the number of elements in the array and what they are. That’s simpler than having several EC columns.
This was a helpful read: