Alteryx Designer Desktop Discussions

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

Change URL for each unique ID and get results for each.

krishguru2000
5 - Atom

Hi

 

Starting off I have a URL(example: https://blahblah.com/?start_date=2022-12-01&end_date=2022-12-31&resolution=period&apex_user_id=1234). The URL is from an API and I eventually run it through a program that gets me the sum of a specific column at the end of the workflow. The result of the workflow with the particular example above returns 1 column for sum with the value 3:

Record | Sum

1             3  

 

Next I have file which has a list of 400+ ids of different lengths(example: 1234, 10005, 1846, 321,.. etc.)

 

I need to run the workflow for each one of these ids that will be added to the end of the url. Each id will be after the "=" sign and replace the 1234 in the example url above. 

The URL will start like: https://blahblah.com/?start_date=2022-12-01&end_date=2022-12-31&resolution=period&apex_user_id= 

And it needs to add each id at the end and run through the workflow and get me the results for each id.

 

The final result should be a table that shows the id and the sum(result of workflow) for each id.

Record |ID         | Sum

1           1234       3  

2           10005     8

3           1846      32

 

I've seen many questions about loops and cannot solve it. Please let me know how to go about this, thank you.

6 REPLIES 6
DavidSkaife
13 - Pulsar

Hi @krishguru2000 

 

Assuming you're using the Download tool to pull the data from the URL? You shouldn't need to worry about looping, as the Download tool will read in and produce the data for all incoming rows.

 

For example:

 

Capture.PNG

Example workflow attached

krishguru2000
5 - Atom

Hi the problem is that some ids get a result and some ids do not produce anything. I need to be able to skip the ids that do not produce anything and get only the ones that produce a sum. I also need to know which ID each sum came from.

 

I have a list of the appended URLs now with all the ids included. So this just needs to run for all the new URLs and show which URL it came from

krishguru2000
5 - Atom

I have attached the workflow here, the connected part is working. I need it to run for all URLS, skip urls that give null values and give me only those with values + which URL it came from. The second unattached file in there contains all the URLs

DavidSkaife
13 - Pulsar

Hi @krishguru2000 

 

Your workflow doesn't work for me as it gives a timeout error, and the database file won't work either as you'd need to export it as a package or provide the file itself.

 

I'm also confused by your problems: how do you know if the ID doesn't produce anything until after you've ran it through the Download tool, and the ID will be included in the URL or a separate field?

 

I'd refer you back to my suggestion, use a base URL and append the ID's to the end, each record will process through the Download tool line by line, any that return 0/null can be filtered out after if required, and the ID field will be retained on the output from the Download tool..

 

You may need to expand further, or share a working copy/package of the workflow - not however you are also sharing credentials for the API call...

Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @krishguru2000,

 

It's a little difficult to test whether it would work without access to the API, however you could wrap your workflow into a batch macro and use the control parameter to change the ID being fed into the URL and also pass the ID back in at the end to identify which record you're bringing back from the macro.

 

I've attached the example, just need to feed in your IDs. If you're still having issues if you can share some screenshots i'm sure we can get to the bottom of it!

 

Kind regards,

Jonathan

apathetichell
18 - Pollux

The workflow should have a filter tool before the json parse. You should check the results for a 200 (or whatever you are looking for) before trying to parse non-existent entries. you should also have a recordid tool somewhere to link your downloaddata/json return to the original request. This can be handled before or after your filter tool depending upon your needs and what other data you have in your workflow.

 

my point is that these are core workflow issues - not download tool/api specific issues.

Labels