Hi folks,
I have a Text Input tool on my workflow, the output goes to the Download tool.
The "GetRideURL" column is set to: "https://ridewithgps.com/trips/{RideId}.tcx?sub_format=history".
I have a sort tool that outputs multiple RideIds.
How do I alter the workflow so that the RideIds from the sort tool get passed to the Text/Download tool?
There must be something simple I am not seeing.
I've looked in the "Basic", "Headers", "Payload", and "Connection" tabs for the Download tool.
Thank you for your help,
Richard Rogers
Solved! Go to Solution.
You could do this two ways. The first (and slightly more complicated) would be to create a batch macro that you pass RideIDs into, and use to replace the text {RideID} in your text input tool. Then you can parse the results inside the macro and return only the information you need. This is useful mostly when you need to access the data in a lot of different macros and want the convenience of building the HTML parsing in a single location.
The easier way would be to append each RideID to your Text Input Tool that contains the 'Template URL' "https://ridewithgps.com/trips/{RideId}.tcx?sub_format=history" which will create one row per RideID. Then pass it through a formula tool where you use the Replace() function to fill your 'template' URL with the correct RideID and then pass that into your download tool. An example of that function would be Replace([TemplateURL], "{RideId}", [RideIDValue]).
Each row passed into the download tool will trigger a download from that website. Be mindful of rate limiting if you plan to pass a bunch of these at one time, or you might end up banned. Consider using the Throttle tool to slow down your requests to only a few per second. And be sure to read the terms and conditions of their website, as many sites don't permit scraping their data in a programmatic way. I'm not sure about ridewithgps.com, and i'm not your lawyer! Do with this knowledge what you will :)
Edit: I looked at your workflow and it doesn't seem like your question and workflow are the same. The workflow seems to indicate you're trying to login to a website and then grab pages of results based on a different URL than the one you provided. What are you looking to pull off here? (if you're trying to pull down all results for a bunch of different users as your workflow suggests, you might want to more elegantly figure out how many pages of results you need to go through to get all of them).
Hey Richard, it looks like i didn't see the second half of your workflow on my laptop when I glanced at it (sorry!). I've added a formula tool that prepares the URL for each row of RideID by using this formula:
"https://ridewithgps.com/trips/"+[RideID]+".tcx?sub_format=history"
That should be all you need if we assume RideID is properly formatted.
I also added a throttle tool to slow your queries down (tweak the settings however you like, it's at 1 per second).
Let me know if this works?
Edit: Ooops, RideID is a number, so to make the formula work I had to add the ToString() function. I reuploaded the corrected version (which works when I test it).
The new formula is: "https://ridewithgps.com/trips/" + ToString([RideID]) + ".tcx?sub_format=history"
Also, you may want to change your password to that site since you included it in the sample :)
Thank you for your help, and the advice on the password!
User | Count |
---|---|
106 | |
82 | |
70 | |
54 | |
40 |