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
5 replies
Subscribers
7 subscribers
Views
1762 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I have a scenario,would like to know whether I am handling it in the best way or
georgej
over 8 years ago
I have a scenario,would like to know whether I am handling it in the best way or is there some other better approaches.
Scenario is like this
I have a rule which returns something like a table row [A:1,B:2,C:3,D:4] ,where A,B,C,D are column names and 1,2,3,4 are respective values.The rule is called in an activity node(script task);we need to save the value of each column to different process variables.
Approach followed
I am invoking the rule once,converting it into a datasubset and storing it in a activity class variable in the inputs section.On the output I am using index() function on the data part(i.e index(ac!datasubsetvar.data,"A",{}) and saving to respective process variables.
Kindly review this approach
OriginalPostID-161439
OriginalPostID-161439
Discussion posts and replies are publicly visible
0
adrianf
over 8 years ago
In practice, this should work. That said, best practices are to use the property() function in a similar manner. The syntax would basically be the same: property(ac!datasubsetvar.data, "A", {}). Property is meant for returning properties of a CDT while Index is meant for returning indexes of an array, even though it can be used in your situation.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tim
Certified Lead Developer
over 8 years ago
I agree that your approach is sound but you should stick to using the index() function as you are currently.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
adrianf
over 8 years ago
Index() and property() are aliases of one another, as per the documentation. You may pick the keyword that semantically encompasses your use. Doing so would be very useful in code that alternates between manipulating both arrays and custom data types, for clarity and readability.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
georgej
over 8 years ago
Thank you Tim and Adrian for your feedback
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tim
Certified Lead Developer
over 8 years ago
It's a good point Adrian, I was favoring index() because of it's sole use throughout all of Appian's own SAIL recipes and wider use.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel