Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
+1
person also asked this
people also asked this
Replies
13 replies
Subscribers
10 subscribers
Views
11577 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Compare Data Changes in CDT
Shashank
over 8 years ago
HI ,
I am trying to capture the audit trail , for data changes in a CDT.
Is there any OOTB function , which might be helpful
Thanks
OriginalPostID-239248
Discussion posts and replies are publicly visible
Parents
0
Stefan Helzle
A Score Level 3
over 8 years ago
Did some small tests. It might not work for all cases, but can be a start:
CdtDiff(cdt1, cdt2):
=with(
local!fieldNames: apply(xpathsnippet(_, "name(*)"), xpathsnippet(toxml(ri!cdt1), "/*/*")),
apply(rule!CdtDiffField(ri!cdt1, ri!cdt2, _), local!fieldNames)
)
CdtDiffField(cdt1, cdt2, fieldName):
=with(
local!fieldOneType: runtimetypeof(index(ri!cdt1, ri!fieldName, null)),
local!fieldTwoType: runtimetypeof(index(ri!cdt2, ri!fieldName, null)),
local!fieldOneExits: tostring(index(ri!cdt1, ri!fieldName, "x_#")) <> "x_#",
local!fieldTwoExits: tostring(index(ri!cdt2, ri!fieldName, "x_#")) <> "x_#",
if(and(local!fieldOneExits, local!fieldTwoExits, local!fieldOneType = local!fieldTwoType),
if(local!fieldOneType < 1000,
{field: ri!fieldname, same: ri!cdt1[ri!fieldName] = ri!cdt2[ri!fieldName]},
{field: ri!fieldname, children: apply(rule!CdtDiff(_,_), merge(ri!cdt1[ri!fieldName], ri!cdt2[ri!fieldName]))}
),
false
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Stefan Helzle
A Score Level 3
over 8 years ago
Did some small tests. It might not work for all cases, but can be a start:
CdtDiff(cdt1, cdt2):
=with(
local!fieldNames: apply(xpathsnippet(_, "name(*)"), xpathsnippet(toxml(ri!cdt1), "/*/*")),
apply(rule!CdtDiffField(ri!cdt1, ri!cdt2, _), local!fieldNames)
)
CdtDiffField(cdt1, cdt2, fieldName):
=with(
local!fieldOneType: runtimetypeof(index(ri!cdt1, ri!fieldName, null)),
local!fieldTwoType: runtimetypeof(index(ri!cdt2, ri!fieldName, null)),
local!fieldOneExits: tostring(index(ri!cdt1, ri!fieldName, "x_#")) <> "x_#",
local!fieldTwoExits: tostring(index(ri!cdt2, ri!fieldName, "x_#")) <> "x_#",
if(and(local!fieldOneExits, local!fieldTwoExits, local!fieldOneType = local!fieldTwoType),
if(local!fieldOneType < 1000,
{field: ri!fieldname, same: ri!cdt1[ri!fieldName] = ri!cdt2[ri!fieldName]},
{field: ri!fieldname, children: apply(rule!CdtDiff(_,_), merge(ri!cdt1[ri!fieldName], ri!cdt2[ri!fieldName]))}
),
false
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data