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
9878 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
Parents
0
Stefan Helzle
A Score Level 3
over 7 years ago
There is a trick that uses updatecdt to update any field in a CDT. The problem with updatecdt is that you cannot create a dictionary with dynamic key names. To do that you create a dictionary with a fixed key name, convert it to JSON, replace the key name with your dynamic name and convert it back to an Appian dictionary. Check the code below. There is one issue. JSON does not handly date and datetime values correctly. To get this you can convert date/datetime values to a decimal. Appian automatically converts a decimal back to a correct date/datetime.
a!fromJson(substitute(a!toJson({X_A_Z_Q_Y:local!valueExternal}), "X_A_Z_Q_Y", ri!name))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Stefan Helzle
A Score Level 3
over 7 years ago
There is a trick that uses updatecdt to update any field in a CDT. The problem with updatecdt is that you cannot create a dictionary with dynamic key names. To do that you create a dictionary with a fixed key name, convert it to JSON, replace the key name with your dynamic name and convert it back to an Appian dictionary. Check the code below. There is one issue. JSON does not handly date and datetime values correctly. To get this you can convert date/datetime values to a decimal. Appian automatically converts a decimal back to a correct date/datetime.
a!fromJson(substitute(a!toJson({X_A_Z_Q_Y:local!valueExternal}), "X_A_Z_Q_Y", ri!name))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data