Alteryx Designer Desktop Discussions

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

Dynamically add multiple ID's to the parameter of an endpoint

rxak
6 - Meteoroid

Hey experts!

 

I have an issue where I have created two different HTTP request methods (GET). The first is to call an endpoint where it filters based on a status. In the JSON of this endpoint, it gives a sampleID. In order for me to isolate this sampleID I have created a Regex which works fine and is then stored in a column called AllSAmples_ID. The issue stems in the second endpoint, where I need to use this sampleID as a parameter. Basically the second endpoint has the format: rest/samples?queryid1=[sampleid];[sampleid2]; (a multi-lookup endpoint) where sampleid has to be created dynamically based on all the records in the column AllSamples_ID (as mentioned, I'm storing all the sampleID's in this column that I have received from the first http method).

 

If I hardcode a sampleID to the second endpoint, it works fine, but the entire point is to do this dynamicall, so it automatically can extract a sampleID and "insert" it to the parameter.

In plain english, loop through the column named AllSamples_ID, add the records to the parameter of the second endpoint separated by a semicolon, and stop when there are no more sampleID's left in the column.

 

It seems like it is not possible to create some type of a for loop in Alteryx, so what would the alternative be to accomplish my challenge?

 

I hope my question make sense - and thanks in advance!

 

 

1 REPLY 1
DataNath
17 - Castor

The equivalent of a 'for loop' in Alteryx is a batch macro. Essentially, this performs a loop of the macro for each parameter you pass into it (the control parameter), until there aren't any more.

 

In your case, it sounds like the control parameter you would pass in (to the upside down question mark anchor) would be your list of Sample ID's that you extract from your downloaddata. Within the macro workflow, you'd configure the Action tool of this control parameter to 'Replace a Specific String' of the API URL for the second request, trimming this specific string down to just the [sampleid] part.

 

There's some great articles on building these but if you get started and need any help, be sure to shout up and the community is always happy to assist!

 

https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/Getting-Started-with-Batch-Macros/t...

https://help.alteryx.com/20221/designer/batch-macro

https://www.youtube.com/watch?v=NNH_K5U5r78

Labels