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
+2
person also asked this
people also asked this
Replies
19 replies
Subscribers
10 subscribers
Views
18529 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
Is there a way to *dynamically* add a new element to a dictionary?
briank538
over 8 years ago
I'd like to at run time add new name value pair to a dictionary. Is this possible?
Thanks.
OriginalPostID-239395
Discussion posts and replies are publicly visible
Top Replies
Stefan Helzle
over 4 years ago
in reply to
paulg0001
+2
A Score Level 3
Why is an update no option? The new version includes to old functions as well. This is a quick solution. I am pretty sure there is a better one. a!localVariables( local!values: {{ id:1, name:"alpha…
Parents
0
Stefan Helzle
A Score Level 3
over 8 years ago
The problem is that updatecdt does not allow dynamic field names. But if you add
a!fromJson(substitute(a!toJson({tzqYx62_01_:ri!value}), "tzqYx62_01_", ri!key))
to the above code, even that is possible. It creates a dictionary with a fixed field name and converts it to JSON. Then it replaces the field name in the JSON string to the desired field name and converts it back to an Appian dictionary.
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
The problem is that updatecdt does not allow dynamic field names. But if you add
a!fromJson(substitute(a!toJson({tzqYx62_01_:ri!value}), "tzqYx62_01_", ri!key))
to the above code, even that is possible. It creates a dictionary with a fixed field name and converts it to JSON. Then it replaces the field name in the JSON string to the desired field name and converts it back to an Appian dictionary.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data