Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Application using R tool

Shockwaved
5 - Atom

Hi,

I would like to make an application in Alteryx using R tool, used for running an R script that makes changes in a column (the number of the column is entered by the user) of some file. So at the moment I'm able to create an input data and link it to the R tool which holds the script. Then link it to the browser to see results. So I don't know how to pass the number of the column given by the user through the numeric up down to the R tool and how read this input inside the script. For clarify the idea:

 

 sample.png

Thank you

3 REPLIES 3
jdunkerley79
ACE Emeritus
ACE Emeritus

Attached a sample doing what I think you want.

 

This keeps columns 1 to the specified number.

 

There is a bug in my R code such that it transposes if only one column but it works otherwise.

 

You have to use a formula to update the value. For simplicity I made it have a variable in the R code to target.

 

Hopefully enough to get you going

 

Shockwaved
5 - Atom

Hi,
The sample that you attached made the work but the problem, is when it replace the value entered by the user interface for 'colNum'. It doesn't replace actually, it appends the new value to the current value. So if you set:
In R tool: colNum = 2
and then the value entered by the interface user is 1, I get colNum=12
So I want to replace the value of colNum not append it.
Thank you

jdunkerley79
ACE Emeritus
ACE Emeritus

 

You're right sorry there was a bug in my Action tool. New formula is:

replace([Destination], 'colNum <- 2', 'colNum <- ' + ToString([#1]))

 

corrected version attached.

Labels