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
8 replies
Subscribers
8 subscribers
Views
5277 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hello Everyone, Does anyone know of a way to get the a!fromJson function t
Jin Pheh
Certified Associate Developer
over 9 years ago
Hello Everyone,
Does anyone know of a way to get the a!fromJson function to respect arrays? Ie:
a!fromJson({"Values":["Alph;a","Beta","Delta"]})
will return a dictionary. When I index 'values' from the dictionary I get a single string representation of the array I started with instead of the array itself.
The problem appears to be that dictionaries themselves don't support arrays as values - for example this expression returns 1 instead of 3:
load(
local!dict: {Values: {1, 2, 3}},
length(local!dict.Values)
)
Does anyone have a way around this shortcoming?
OriginalPostID-197406
OriginalPostID-197406
Discussion posts and replies are publicly visible
Parents
0
Stefan Helzle
A Score Level 3
over 9 years ago
To be more dynamic on datatypes you could use the reduce() function and a simple rule that just increments an integer by one.
load(
local!dict: {Values: {1, 2, 3, 4, "a", 1.5}},
reduce(rule!CountItemsForReduceFunction, 0, local!dict.Values)
)
CountItemsForReduceFunction(value (integer), item (any)):
=ri!value + 1
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Stefan Helzle
A Score Level 3
over 9 years ago
To be more dynamic on datatypes you could use the reduce() function and a simple rule that just increments an integer by one.
load(
local!dict: {Values: {1, 2, 3, 4, "a", 1.5}},
reduce(rule!CountItemsForReduceFunction, 0, local!dict.Values)
)
CountItemsForReduceFunction(value (integer), item (any)):
=ri!value + 1
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data