Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

how to bypass a union IF one stream is Null

anthony
11 - Bolide

Hi, I am trying to figure out how to easily bypass a Union if one stream is empty/null/na or if API in macro is not available.   I have run into this a few times now and have not found a easy way to get past this issue.  I think I could probably use a macro with a set of detours/control parameters?? but that seems like major overkill.

 

bypas

 

Here is what I am trying to accomplish- take my list of skus - pass to a join and join skus to the data from the lookup table.  For all skus in the lookup, join then pass through.  If skus not in lookup via left join - then use the macro to call an API to get the missing data - that data is then written to lookup table(in the macro) for future reference so I am not hitting api unless a new sku(s) is added.

 

If the api is not available or all skus are in the lookup table (eg no left join), then the union does not pass along the good stream to complete the workflow.

 

Anyone have a clever approach to get this process to work as intended?

 

Thanks

Anthony

 

FYI - high level of macro - basic input - get data - output and write to table new data.

macro

 

 

 

 

15 REPLIES 15
anthony
11 - Bolide

Kane thanks.  I like the idea of checking for connection and then filtering and using the info to decide if to move forward.

 

However, I might have another solution for my need I will test tomorrow in the office, and the failure modes.

 

I guess what i am really trying to accomplish is to LOOKUP/Join new data if it showed up in my input data while considering failures.  I was using the union to keep moving down stream with the new data to complete the workflow.


I am going to try the approach below - send to macro if new data to lookup and append to lookup table, if it fails - missing/no connect it just dies. If it fails then the new sku data just does not get the lookup data and is unioned later with nulls(and fixed next time marco works). Everything else pass through the second join/lookup that was/not updated during the macro run.  This is assuming all the timing/order works out with the block until done.

 

The second join adds some overhead but my data is small enough that I perfer simple over faster.

 

Capture.PNG

chris_love
12 - Quasar

Was this solved?

anthony
11 - Bolide

Solved? Yes if you use quotes.

 

Here is what I learned: use dummy data and filter off downstream to pass through something, use a dummy output like below in macro so that it keeps processing down stream.

 

Capture.PNG

 

I was able to hack my way around my problem by using above macro to write any new data to yxdb and then 

pick up later in the stream as needed.  I have the dummy output that is doing nothing other than stopping union from moving forward as it waits for macro.

 

If macro fails it keeps moving forward and if macro gets new data it updates my lookup table to append to data stream on join over.

 

Capture.PNG

 

"solved"

 

on to new problems

anthony
11 - Bolide

Thought I would post a follow up to something I thought that would work and did - using a detour/control parameter in the macro if passing null to macro.

 

Capture.PNG

 

So now i check the input with a filter and if null it updates the detour control so that an error is not generated and also pass the data stream to the macro input.

 

Capture.PNG

 

anthony
11 - Bolide

I finally got around to solving my problem - which is: check to see if I can connect to a server and if not then bypass a macro so my output is still created with missing data.

 

I created a bat file that pings the server and writes to a temp file. I then use that ping result to filter on the response. If 'timed out' then append NULL to the lookup table stream. That null is then used to mark all incoming sku's null which is a control parameter on the macro.

 

If control parameter is null then it stops internal macro workings with detour and just outputs a null vs getting the lookup response I need when connected to the server.

 

As a side note: I tried using curl but it kept sending a windows error message back that it could not connect and it would not pass null down stream... so I came up with this hacky work around.

 

Capture.PNG

 

pmiecz
5 - Atom

Another way to bypass union is to use "Detour End" tool. It will allow data flowing even though one input is null or empty.

Labels