Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
xkr
Contributor II
Contributor II

tDBOutput strange Insert or Update behaviour, always uses "0" if no id given

Hi Guys,

I've searched the forums but haven't found any suitable thread regarding my problem.

I'm currently playing around with database components and found a strange behaviour of the tDBOutout component, which is either bugged or I'm too dumb to understand...

I have a super simple flow for testing the tDBOutput component... To immitate a later API endpoint, I'm using a tFixedFlowInput and want either to update data in the database if the ID is already present or to insert a new datarow in the database if there's new data and therefore no ID exists...

no matter if I configure the data action to "Insert or update" or "Update or Insert", if the given ID is null/empty, the tDBOutput component fills the ID automatically with "0", leading to the stupid fact that every data that has no given ID yet, instead of inserting a new value, the datarow with ID "0" in the database will be updated, the component wont insert any new data....

this is my flow and the config of the tDBOutput component and of course the ID column is set as Key in the schema

xkr_0-1727683114078.png

Of course I know that primitive types cannot be null, so for an uninitialized integer it will always be "0". But what's even the point to have an "Insert or Update" command, when the component always takes a "0" and therefore never can a do a proper Insert?

What am I doing wrong here??

Thanks in advance

 

 

Labels (3)
2 Replies
xkr
Contributor II
Contributor II
Author

After playing a bit more, I figured out that you can configure each field in the advanced settings of the tDBOutput component after ticking the "use field options" box... if you then, deselect your ID column in the "Insertable" column and split your flow into 2 flows depending if the values you've been given are empty/null, and adding a separate Update component, it works...

this is the new flow...

xkr_0-1727686271068.png

I'm still really wondering if this is the best solution or if there's a better one which only uses one tDBOutput component with an "Insert or Update" setting??

fcolagiacomo
Contributor III
Contributor III

Is ID an autoincrement attribute or not?

If not, how can database assign a value not 0 to id attribute?