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
Replies
6 replies
Subscribers
8 subscribers
Views
2886 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I have Question related to CDT Array. I have two CDT Arrays CDT1 and CDT2 I
rishij
over 9 years ago
I have Question related to CDT Array. I have two CDT Arrays CDT1 and CDT2
I have to compare CDT1.id = CDT2.id
if the ids match then CDT1.value is to be update by CDT2.value
Please let me know if you have any solution.
OriginalPostID-186559
OriginalPostID-186559
Discussion posts and replies are publicly visible
0
Tim
Certified Lead Developer
over 9 years ago
forum.appian.com/.../summary
The shared component above will help you with the updating of the value. Should have everything you need.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 9 years ago
If you want to do this out-of-the-box, then you could also use an apply of a rule that takes a single instance of each CDT and then uses a type constructor with conditionally set field values.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
rishij
over 9 years ago
hey philip, do u have some example or code snippet, that i could use for this.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
monikar
over 9 years ago
Hi rishij,
This is my understanding of the requirement: Value of CDT1.value is to be replaced with CDT2.value when the CDT2.id matches CDT1.id
For this I propose the following solution in two steps.
1. To get the updated array of CDT1.value you can use the displayValue function
Ref code: apply(fn!displyValue(value: _, inArray: CDT1.id, replacement: CDT2.value, default: default value), CDT2.id)
2. In order to set it to CDT1.value you can use the shared component specified by tim.clarke.
Ref code:
updatecdt(CDT1, { value: {updated array} })
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
rishij
over 9 years ago
thank you very much @monikar
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 9 years ago
Bit delayed, but I was thinking more like something below.
A supporting rule, eg rule!myRule(), with two non-array inputs of CDT1 and CDT2 of the equivalent types:
type!CDT2(
value: if(
isnull(
ri!CDT1.value
),
ri!CDT2.value,
ri!CDT1.value
)
)
...then a call of that rule within an apply, iterating over the arrays of the two types of CDT:
apply(
rule!myRule,
merge(
local!arrayOfCDT1,
local!arrayOfCDT2
)
)
You could edit the supporting rule to map any number of fields, conditional or otherwise.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel