Append Existing errors
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
I've attached a sample workflow. What do you think?
Best,
Roland
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks for reply, I am using a lower version of designer and not able to use the file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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:
Best,
Roland
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@RolandSchubert this is a neat trick the i never knew before!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
