Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Inputting Alteryx outputs into a Query

mfranchino21
7 - Meteor

I have my Alteryx workflow finished, and I want to put the output data into a query. Please let me know if Alteryx can do this automatically. Here is an example of what I would want...

 

Alteryx Output:

StoreApplesOrangesPeaches
Walmart432
ShopRite958

 

Then, I would only want to put the Apples and Oranges data into my query, with each entry looking like this:

 

Select discussion example

     In Apples('4', '9')

     and

     In Oranges('3','5')

 

So essentially, I want to get the data into the query following the format 'text,' for each input, and only use data from the apples and oranges row. 
I hope I explained this well lol, any help is appreciated. 

8 REPLIES 8
AndrewDMerrill
13 - Pulsar

You just want a line of text in that format? Why only Apples and Oranges columns? Are they selected by you?

 

Is this format what your looking for?

 

In [Column 1]('[Row 1]','[Row 2]','[Row 3]',...)

and

In [Column 2]('[Row 1]','[Row 2]','[Row 3]',...)

and

...

 

mfranchino21
7 - Meteor

Thanks for the reply, 

Yes, those columns are selected by me. They would be the only ones in my scope. And yes, in that format.

Thank you

apathetichell
18 - Pollux

MULTI-FIELD FORMULA - convert all of your columns to text using tostring([_CurrentField_]).

next.

split your datastream 

SUMMARIZE 1:

settings concatenate apples

(' ',' ') are your settings

 

SUMMARIZE 2

settings concatenate oranges

(' ',' ') are your settings

FORMULA tool

add "IN "+your concatenated output

 

UNION

combine both of your data streams in UNION - I don't care about the order.

 

SUMMARIZE

concatenate both entries coming out of UNION - use AND as your seperator.

 

FORMULA tool:

add "Select discussion example " to your concatenated value

 

mfranchino21
7 - Meteor

Thank you so much!

AndrewDMerrill
13 - Pulsar

Here is the workflow version of ^

2023-11-15_15-49_Text Output.png

 

If this is what you were looking for, please mark solution and like, so that others can find information more easily!

mfranchino21
7 - Meteor

is there a way to run the query at the end?  

 

in the example, it is just two "in" statements, but could i run the entire query that those "in" statements sit in? As in, get those into the query and then run it? 

 

Thanks. 

mfranchino21
7 - Meteor

is there a way to run the query at the end?  

 

in the example, it is just two "in" statements, but could i run the entire query that those "in" statements sit in? As in, get those into the query and then run it? 

 

Thanks

rzdodson
12 - Quasar

@mfranchino21 depending on how the rest of your workflow is set up, you can do the following:

  1. Connect the Summarize tool to a Drop-Down tool.
  2. Connect the Drop-Down's Q anchor to the lightening bolt anchor of the Input tool that contains your SQL query. This will create an Action tool separating your Drop-Down and Input tools.
  3. In your Action tool, select 'Update Value (Default), and 'Input Data>File (this should be your full SQL query's syntax).
  4. In your Action tool, you can select "Replace a specific string', and find the IN statement you are needing to substitute (see below). Connect a Browse tool to the end see all of the results. Since you are using an Interface tool, your workflow will now become an Analytic App.

Solution.png

Labels