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
10 replies
Subscribers
6 subscribers
Views
4677 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Hi All, I have a Expression Rule below which returns me a Data value
sariqs
over 10 years ago
Hi All,
I have a Expression Rule below which returns me a Data value of DocumentMetaData CDT :
='type!{
localhost:8080/.../}DocumentMetaData'(
documentId: fn!tointeger(ri!doc)
)
I need to create Data value from documentlist hence I have used apply function to achieve it shown in first image in script task node but it gives an error "Invalid Cast: Cannot cast from type 'List of Document' to type 'List of Data Store Entity', for variable 'pv!documentmetadatastore'".
I am not sure what is the problem here, please check each image for more details on use of script task and expression....
OriginalPostID-134728
OriginalPostID-134728
Discussion posts and replies are publicly visible
0
sariqs
over 10 years ago
Here the function prepareDocumentMetaData used in script task expression contains the type expression :
='type!{
localhost:8080/.../}DocumentMetaData'(
documentId: fn!tointeger(ri!doc)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
kinfuh38
over 10 years ago
Sariq, you have used a rule input context 'ri' in your script task. You may use pv instead.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tim
Certified Lead Developer
over 10 years ago
Firstly your expression uses "ri!loanDocuments", this should be ac! or pv! as the array variable for your apply() loop. Can you confirm your PV documentMetaDataStore is configured of type DocumentMetaData?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sariqs
over 10 years ago
Yes Please ignore the ri as its copy paste mistake, I was trying to make another expression rule and call it in script task.
@Tim PV documentMetaDataStore is configured of type DocumentMetaData only.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sariqs
over 10 years ago
Can anyone please shed some light on this issue.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
SANTOSH S KUNDLIK
Certified Associate Developer
over 10 years ago
are you sure 'pv!documentmetadatastore' is of type DocumentMetaData & Multiple ?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sariqs
over 10 years ago
Yes DocumentMetaData and Multiple also as shown in attached figure, also check second image where the corrected expression is there which Tim has mentioned above.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
kinfuh38
over 10 years ago
In your process model change the process variable data type to DocumentMetaData CDT
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sariqs
over 10 years ago
Hi I have changed the variable data type to DocumenMetaData CDT though it was not working. Though it was one of the mistake I have made including other two items below.
1. The object loadDocuments I was iterating was not having any value at all , which I have corrected.
2. For the script task I was using the operator as "is stored as" which I have changed to "is appended to list" as shown in attached image and its working now.
The 2nd one is bit strange for me that why the first operator "is stored as" was not working ?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sariqs
over 10 years ago
I found the problem for the 2nd item, the mistake was in the configuration of script task. What I was doing that I was selecting the "documentMetaDataStore" in the input variable list there I was configuring it to "Save Into" the same variable which was not required.
Please check attached image for the reference where annotated configuration for "Save Into" is not required.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel