Alteryx Designer Desktop Discussions

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

Skip Google Sheets output if 0 records

eknudson
7 - Meteor

When using Google Sheets as output and there are occasionally 0 records write I get error:

"Error trying to publish spreadsheet: HTTP/1.1 400 Bad Request"

Is there any way to skip output to connector if no records?

 

Thanks!

 

13 REPLIES 13
ed_hayter
12 - Quasar

You can use a stop until done tool and branch off to count records first. Then if records = 0 have an error message tool attached. Set the workflow settings to stop workflow on error and that should skip second flow that outputs to the google sheets connector.

eknudson
7 - Meteor

Thank you for sharing, apologies for not being more specific but looking for a solution that doesn't result in any errors.

 

Does your solution trigger errors?  (Appears so upon review but not 100% certain)

ed_hayter
12 - Quasar

Apologies - my solution does produce an error because that stops the flow - you could launch a detour if the count = 0 to take down a separate flow that ends with nothing. With more thought i think this would then need to be an app to update value.

BS_THE_ANALYST
14 - Magnetar

Sounds like a great time to use Alteryx's new Control Containers: https://help.alteryx.com/20231/designer/control-container-tool 

 

 

apathetichell
18 - Pollux

the traditional way to do this is to drop your google sheet tool into a macro. add the record count as mentioned by @ed_hayter - have the macro after a filter testing if Record count >0.

ed_hayter
12 - Quasar

I have given it a go with control containers and think that only the container that meets the filter will run

 

Edit corrected workflow

 

Pretty sure this works as the tools in the activated container highlight whereas the others do not

eknudson
7 - Meteor

Thanks, tried looking at the tool example and forum posts but couldnt figure that out.  If you have any relevant links to steps thatd be greatly appreciated!

ed_hayter
12 - Quasar

Basically in the first control container you want your test and your output. Then from the count records test you want that connected to a filter outside the control container and linked to two different control containers at their input anchors. Within those two paths you want one with just a browse tool (no output) and one that connects to google sheets (this one should be connected to the filter test where count is not 0).

 

The tools in the control container branches should be connected up to your output within the first control container.

 

The set up in my flow for the second response is configured correctly it just needs a google connector for the false anchor control container. I had two examples in the flow one which goes down the 0 records route and one that goes down the output route.

PeteZeel
5 - Atom

We struggled with this same issue for a long time and worked with Alteryx support on it.  Crucial for us was that no error is returned.

You should take a look at the Google Drive tool instead.  Getting the connection set up properly in the first place is more difficult, but you should be able to avoid the error condition.

Labels