Alteryx Designer Desktop Discussions

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

Append Existing errors

Yuri24
8 - Asteroid

Hello Experts,

 

I am writing a row to a database with the designer. I am using the "append existing" with the odbc database connection. Workflow works fine when there is atleast a row of data to write to the database, however when there are 0 rows to write I get an error.

 

Append field map does not match number of insert columns for table:<table name>

 

The table in the database has a primary key and when there is no data to write it still tries to write something and fails. I added a filter to check in the workflow  on the pk column being not empty before writing, however even if the pk column is empty that branch that is writing to database is being triggered. 

 

Is there a tile that will help prevent this?

 

TIA

6 REPLIES 6
RolandSchubert
16 - Nebula
16 - Nebula

Hi @Yuri24 ,

 

you could use a macro to handle the process of writing to the database.

 

Within the macro, the Condition tool can be used to enable/disable a Tool Container. The Output Data tool is placed within this container and is executed only, if Record Count > 0.

 

P2.jpg 

I've attached a sample workflow. What do you think?

 

Best,

 

Roland

Yuri24
8 - Asteroid

Thanks for reply, I am using a lower version of designer and not able to use the file. 

RolandSchubert
16 - Nebula
16 - Nebula

Hi @Yuri24 ,

 

I've modified the version, set it to 2020.1, hopefully that works. Both workflow and macro are attached, 

 

btw: You can change the version of a workflow by editing the file using a file editor (I use Notepad ++ or UltraEdit) , modify the version entry and save the file:

 

2021-06-24_07-18-55.jpg 

 

Best,

 

Roland

DawnDuong
13 - Pulsar
13 - Pulsar

@RolandSchubert  this is a neat trick the i never knew before!

Yuri24
8 - Asteroid

My input to the macro is coming from a select tool after performing multiple joins between multiple tables and some spreadsheets. The macro however doesnt seem to accept the input throwing "The control parameter "name" must be mapped to a field" upon connecting the output of select tool to the macro input.

 

In the yxmc file I have already edited the connection to the database from Test.yxdb

 

Am i doing something wrong?

RolandSchubert
16 - Nebula
16 - Nebula

Did you connect the input data (i.e. Select tool) with the "D" anchor of the macro and a Count tool with the Question anchor?  Maybe it would be helpful if you provide some screenshots.

Labels