Dev Space

Customize & extend the power of Alteryx. SDKs, APIs, custom tools, and more!
Don't forget to submit your entry for the Excellence Awards by October 30! | Need more information about the program? Check out the blog here

Update Value in R Tool - Macro/Analytical App

5 - Atom



I'm not familiar with R, but I am using a package to extract weather data from the Bureau of Meteorology in Australia (

I want to update a field to change the (Station_ID). 
which is shown in the line.


Normal Syntax:
df2 <- get_historical(stationid = "32078, type = "max")
## 32078 is the Station_ID

df2 <- get_historical(stationid = "ValuetoADD", type = "max")
## ~48,000+ daily records 


I'm using the
Station_ID <- '%Question.ValuetoADD%' 

for the interface. 



Attached my workflow. 

Also, want to know if it is possible to create a batch macro that would extract weather data for all of Station_IDs???


10 - Fireball

Hey @hillsn92, no need for a batch macro here.  R has looping commands you can use.  The basic process is this:


  1. Read in the Alteryx data into a dataframe (you already did this with variable df)
  2. Loop through each Site in the dataframe, calling the get_historical function and outputting to Alteryx


The code to do this looks something like the following:


df <- read.Alteryx("#1",mode="data.frame")

for (site in df[,'Site']) {
  df2 <- get_historical(stationid = site, type = "max")
  write.table(df2, row.names = TRUE, col.names = TRUE)
  write.Alteryx(df2, 1)