Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dynamic Input with SQL Queries

Similar presentations


Presentation on theme: "Dynamic Input with SQL Queries"— Presentation transcript:

1 Dynamic Input with SQL Queries
A look into the options of dynamic SQL queries and their applied uses.

2 Preparing the SQL query
The BEGIN_REPLACE and END_REPLACE strings will be our targets for string replacement.

3 Preparing the Parameter .CSV
Using a CSV to establish parameters is a great way to configure the dynamic input for your SQL query. In this example, we will be making a report that gathers information from the previous week’s data. In order to do this we need to establish parameters based on what day of the week it is.

4 Configuring the module.
Begin by setting up a simple filter with a date time condition. Here we are going to use DateTimeFormat() to produce the day of the week and compare it against our parameters.

5 Set up the query Click edit, set up your connection, and paste in your SQL query.

6 Time to set up the query Select “Replace a Specific string” and we will Establish the conditions of String replacement.

7 Establish the string replacement
We have 2 targets set up to be used for replacements. Each target must be typed just how it is in the query and make sure that you did not use a word that you will use elsewhere in the query by mistake.

8 Incorporating the Summary Tool
In a case where we want to look at just certain records and we have a list, the summary tool can also be incorporated in this method. In this example, we will be using a .csv file, however any format that you can get into Alteryx will work, whether it’s a alteryx database file or an output from a SQL query.

9 Preparation It’s important to remember that we are adding this directly to a SQL query, so, syntax is very important. Make sure that you put your target field in quotes using the Formula tool.

10 Concatenation Add your Summary tool, then click Add > String > Concatenate. Make sure your separator is set to a comma so it functions correctly in the Where Clause.

11 Set up Query in Dynamic Input tool
Set up your query with your target string. This time we will be targeting CASE_REPLACE

12 Multiple Techniques We can eliminate the Formula tool entirely by building it’s functions into the Summary tool’s concatenate functions. By using an apostrophe in start and end, as well as putting the apostrophes around the comma separator, we can actually achieve the same effect without using a formula tool.


Download ppt "Dynamic Input with SQL Queries"

Similar presentations


Ads by Google