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
6 replies
Subscribers
8 subscribers
Views
3176 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hello, relatively new to Appian and have been stuck on this issue for a little w
johng373
over 9 years ago
Hello, relatively new to Appian and have been stuck on this issue for a little while. Trying to take 2 values from one CDT which contains many fields and copy these 2 fields to another CDT.
- Source CDT: pv!Buyer (CDT can store multiple values)
- Target CDT: pv!projectTask (CDT can store multiple values)
I have a rule called "CopyFields" which has 2 inputs which are CDTs (Any Type). My rule has 2 lines:
={
ri!projectTask.project: ri!Buyer.project,
ri!projectTask.task: ri!Buyer.task
}
I have a apply() function in my Process Model which calls this rule:
apply(rule!CopyFields, pv!Buyer, pv!projectTask)
I keep receiving a "Invalid index: Cannot index property 'buyerProject' of type Text into null value of type ProjectTask?list) (Data Outputs)" even though the CDT contains a "buyerProject" field which is of type string and there is a value within this field at index 1 and 2. Can anyone help steer me in the proper direction? Than...
OriginalPostID-195119
OriginalPostID-195119
Discussion posts and replies are publicly visible
0
johng373
over 9 years ago
...ks in advance.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Jim Schweitzer
Certified Lead Developer
over 9 years ago
Try using a merge() around your args like:
apply(rule!CopyFields, merge(pv!Buyer, pv!projectTask))
forum.appian.com/.../Looping_Functions.html
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
johng373
over 9 years ago
Thanks for the suggestion. I tried it out and received an error "Only list arguments are allowed." Based upon my original error message, I think the issue is occurring because apply() cannot see/access pv!Buyer.buyerTask. If I look at the variable values, I can see that pv!Buyer[1].buyerTask = 44 and pv!Buyer.buyerProject = 10200. However, when I call apply(), I am unable to access the value at pv!Buyer[1].buyerTask and copy that value to pv!projectTask.Task. Is there a way to loop through 1 multi-valued CDT and set values into another multi-valued CDT? I am probably missing something here but I have been able to do this only when the source CDT is not multi-valued.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
bhupinders
over 9 years ago
can you please try this?
local!Buyer: apply(
'type!{http://<uri>/appian}Buyer'(
project: _,
task: _
),
merge(
ri!projectTask.project,
ri!projectTask.task
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sonalk
over 9 years ago
Hi John,
Try the shared component "CDT Manipulation" as shared in the link below can be useful.
forum.appian.com/.../summary
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sikhivahans
over 9 years ago
@johng Hi, what @jims has suggested above should do the job. The error message you see might be because of the reason that you are passing a single valued variable where an array is expected.
If the variable you are making use of, isn't in the array format, then you can typecast the data to the desired type. For instance, if pv!Buyer is of single type then you can turn it into an array that holds multiple values by using casting as below:
cast(typeof({type!Buyer()}),pv!Buyer)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel