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
16 replies
Subscribers
7 subscribers
Views
9885 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Update Property In Array Of Objects
minalabib
over 7 years ago
I am fairly new to Appian, and I want to dynamically update a property in array of objects (the objects are of any type).
so in terms of other programming language, something like below:
ri!List_Of_Any_Type_Object[ri!Index_Of_Object].<Property_Name> = value
OriginalPostID-248744
Discussion posts and replies are publicly visible
0
venkateshs329
over 7 years ago
@Stefah: Can i need to create one more expression rule for updatecdt with three inputs like as you said[data,field,value] ?
If it is correct but you are passed onlly two parameters in updatecdt function in line num 34
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 7 years ago
updatecdt() has two parameters, the CDT itself and a list of fieldname/value pairs. Why would you want to create another expression?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
venkateshs329
over 7 years ago
ok , thanks for the response stefan . i passed below data as inputs it's return an error.
Expression evaluation error at function 'updatecdt' [line 29]: Error evaluating function 'updatecdt' : Length of input arrays must equal length of CDT/Dictionary array
data: {
{name:"vsuram",dept:"IT"},
{name:"vsuram",dept:"IT"}
},
Field:"Test"
value:123456
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 7 years ago
Your example data is a list of data. To update this you have to use the apply() function like apply(rule!updateCdt(data:_, field: "Test", value:123456), local!data)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 7 years ago
It might not work for dictionaries without some changes. I tested with CDT types only.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
venkateshs329
over 7 years ago
Ok thanks stefan , as of my knowledge For dictionaries the below rule work
updatecdt(ri!items,{"TEST":repeat(count(ri!items),ri!value)})
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
<