Alteryx Designer Desktop Discussions

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

Group by ID to run the R tool

knozawa
11 - Bolide

Hello,

 

I have a workflow to calculate X and Y coordinates using igraph library in R tool.  My input file contains project group ID, source, and target.

I would like to calculate the X and Y coordinates within the same group.  I thought using a batch macro to filter by group would be the way to do it.

Group by ID to run the R tool.png

However, this batch macro created many unnecessary duplicated rows - I'm sure I'm doing something wrong.

 

Does anyone know how to run the macro contains R tool and calculate the X and Y coordinates within the same group?

 

Sincerely,

Kazumi

9 REPLIES 9
zoeuno
7 - Meteor

Hi there - I'm so sorry but where can you post question? I have a question too but I can't find the post button anywhere.

knozawa
11 - Bolide

@zoeuno,

 

Go to the "Join the Discussion" from either designer or server tab.

Join the discussion.png

Click "New topic"

New topic.png

 

Then you can create a question.

New Message.png

 

When you create a question, you need to label your question before posting it.

 

Sincerely,

Kazumi

 

zoeuno
7 - Meteor

Thank you so much!!

patrick_digan
17 - Castor
17 - Castor

@knozawa Can you post a small sample set of your data as well as your R code? If you can post your macro as well, that would be helpful!

knozawa
11 - Bolide

@patrick_digan,

 

I've attached a sample macro workflow.

 

Sincerely,

knozawa

patrick_digan
17 - Castor
17 - Castor

@knozawa I think you need to adjust your action tool to change the simple filter line (you're currently replacing the custom filter which is filled not but not being utilized):

Capture.PNG

 

Here is a simpler method to accomplish the same thing: 1) I deleted the control parameter, action tool, and filter from your macro:

Capture.PNG

 

2) in the workflow that calls this macro, I would summarize your ID and group by it in the macro:

Capture3.PNG

The control group by is a nice little batch macro feature when you just need to run the data through in groups.

 

knozawa
11 - Bolide

Thank you, @patrick_digan!

 

Your workflow worked great! 

 

I'm curious why using the action tool to update the ID didn't work correctly.

Action tool.pngSincerely,

knozawa

patrick_digan
17 - Castor
17 - Castor

@knozawa Good question! The filter tool has 2 modes, basic(simple) and custom. When you fill out the basic filter, it automatically copies the text into the custom box, but the custom box isn't actually being used at all other than for display purposes. When your second group of records is sent through the macro, your filter basically looks like this:

Capture2.PNG

You're changing the custom filter, but the basic filter is the one being used. The easiest fix would be to change your action tool to replace the basic filter:

Capture.PNG

 

For what it's worth, I exclusively use the custom filter. As an alternative, you could switch your filter tool to custom using the radio buttons and then your existing action tool would be setup correctly:

Capture3.PNG

 

 

Custom filters are the way to go :)

 

knozawa
11 - Bolide

Thank you, @patrick_digan!

 

I've learned something new today!

 

Sincerely,

knozawa

Labels