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
6 subscribers
Views
2795 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Process
Hi I have a ReviewDocuments CDT which contains two multi value child CDTs.
suem
over 9 years ago
Hi
I have a ReviewDocuments CDT which contains two multi value child CDTs.
I have a documents array containing 2 documents and a CDT FieldworkAnalyticalReview array with 3 sets of details.
Each FieldworkAnalyticalReview needs to be associated with each of the documents
i.e.
Documents: {A,B}
FieldworkAnalyticalReviews: {1,2,3}
Which needs to become :
1. ReviewDocuments CDT ID=1 with 1A
2. ReviewDocuments CDT ID=2 with 1B
3. ReviewDocuments CDT ID=3 with 2A
4. ReviewDocuments CDT ID=4 with 2B
5. ReviewDocuments CDT ID=5 with 3A
6. ReviewDocuments CDT ID=6 with 3B
What would be the best way to achieve this.
Thanks
OriginalPostID-193229
OriginalPostID-193229
Discussion posts and replies are publicly visible
0
jackm829
A Score Level 3
over 9 years ago
Use a join table between FieldWorkAnalyticalReview and Documents. This may be called FieldWorkAnalyticalReview_Document. There will be at least 3 fields - add other metadata fields as you like. The ID (primary key) of this type, the foreign key ID of the Document, and the foreign key ID of FieldWorkAnalyticalReview. I would probably recommend not nesting the types - as in the screenshot. Your queries may return more data than you need. You could just soft-link by ID.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
suem
over 9 years ago
We're having trouble with the syntax required to populate the cdt for the join table. We've tried lots of different combinations but haven't hit the right combination of functions yet. Any ideas on that please.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sonalk
over 9 years ago
Hi Suem,
Not sure if you have already gone through the below related forum posts link :
forum.appian.com/.../e-145331
forum.appian.com/.../e-190101
forum.appian.com/.../e-153616
Please check if it helps.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 9 years ago
Bit of a complex one this, but the below pretty much does what you want. Sue - I'll contact you directly with a more complete solution.
load(
local!documents: {"A", "B"},
local!reviews: {1, 2, 3},
local!reviewArray: reduce(
fn!append,
{},
apply(
fn!insert(
{},
local!reviews,
_
),
enumerate(
length(
local!documents
)
) + 1
)
),
local!documentArray: reduce(
fn!append,
{},
apply(
fn!insert(
{},
local!documents,
_
),
enumerate(
length(
local!reviews
)
) + 1
)
),
apply(
fn!concat(
_,
_
),
merge(
local!reviewArray,
local!documentArray
)
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
suem
over 9 years ago
Hi thanks sonalk, Phil. I'll try out the apply merge approach as it looks like it will do exactly what we want. Thank you
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
suem
over 9 years ago
Hi all, I’m afraid we’ve had to re-work our output CDT to match others in the system so it’s been simplified to the following:
ReviewDocument :-
The two input CDTs, Documents and Reviews:-
For each combination of Review and Document we need to write a ReviewDocument.
For example if we have 3 rows in Review {“A”,”B”,”C”} and two in Document {1,2} then the output ReviewDocument will contain 6 rows ie A1, A2, B1, B2, C1, C2 where ReviewDocument .farId = gtFieldworkAnalyticalReview.id and ReviewDocument .assignmentDocumentId = gtassignmentDocument.appianDocumentID
So far we have had little success in nesting the functions and have yet to discover the correct combination which seem endless -
single rule in a script task output, or via the script task inputs or possible using an MNI?
thanks
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel