Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
TTH1
Contributor II
Contributor II

How to create a new column as AUDIT_TYPE in Qlik replicate

Hi All,

I need to create a new column as AUDIT_TYPE in that whatever the update data from source should show as UPDATE same for INSERT as well, as below 

 

AUDIT_TYPE

INSERT

UPDATE

INSERT

Labels (2)
4 Replies
Arun_Arasu
Support
Support

Hello @TTH1 ,

Thanks for reaching out to Qlik community.

If I have understood your question correctly , you are trying to add a column which should track which operation is performed during replication Insert/update/delete , if that is the case , then please refer to the below user guide

https://help.qlik.com/en-US/replicate/May2023/Content/Global_Common/Content/SharedEMReplicate/Custom...

You can use the header "AR_H_OPERATION"

Value in Change Processing
Can be one of the following: INSERT, UPDATE, or DELETE.

Value in Full Load
INSERT

You can add a new column thru transform and set the value to reflect from "AR_H_OPERATION"

Please refer below user guide for more information

https://help.qlik.com/en-US/replicate/May2023/Content/Global_Common/Content/SharedEMReplicate/Custom...

 

Hope the above answers your question 

Thanks & Regards

Arun

TTH1
Contributor II
Contributor II
Author

Case

then $AR_H_OPERATION='INSERT' then

VARCHAR(10) 'INSERT' 

Will this works how to do it for Update logic

 

Steve_Nguyen
Support
Support

we have a good article forum below :

https://community.qlik.com/t5/Qlik-Replicate/Get-First-Value-on-New-Columns-using-Expression-Builder...

 

 

https://community.qlik.com/t5/Qlik-Replicate/Not-to-perform-cdc-on-a-column/td-p/2063364

Help users find answers! Don't forget to mark a solution that worked for you! If already marked, give it a thumbs up!
Heinvandenheuvel
Specialist III
Specialist III

Do I understand it correctly and you desire to use a (global?) table transformation add a column named 'AUDIT_TYPE' and that column should indicate on target how the row data was obtained - through UPDATE or INSERT. Correct?

  • You'll likely to want to add a  USER and DATE-TIME column as well.
  • You may want to investigate whether the business doesn't really want CHANGE TABLE rows for full audit of the life of a target row, retaining the insert after update(s) and even deleted
  • You might was to also look at audit tables ( documentation: C.1 Using an Audit table ) but those are probably over the top, very few folks end up using those.
  • If you also want to audit the DELETE operation then you can use the operation_indicator function which allows you to specify any arbitrary value for insert/update/delete and make a delete become a 'soft' delete = update + flag.

>> Case then $AR_H_OPERATION='INSERT' then VARCHAR(10) 'INSERT'

This allows you to pick any value to represent 'INSERT' but why not just assign $AR_H_OPERATION ? It will do the Insert and Update if that actual wording is as desired which appears to be the case from the original question.

Hein