mapping expression I used:
$items.map(val=>{\"lineItemName\":val.description,\"unitCost\":val.unitPrice,\"contractDetails\":{\"activity\":'20_'+jsonPath($,\"items[*].projectActivity.chartCodes[*].chartCode\").find(x=>x.supplementalType=='BOMA').uniqueCode+'_9999'},\"additionalCoding\":{\"workOrderNumber\":JSON.stringify($project.projectId)}})
It gives me output as follows:
{\n \"order\": {\n \"orderLineItems\": {\n \"orderLineItem\": [\n {\n \"lineItemName\": \"Architecture Fees\",\n \"unitCost\": \"1000\",\n \"contractDetails\": {\n \"activity\": \"20_7845_9999\"\n },\n \"additionalCoding\": {\n \"workOrderNumber\": \"2\"\n }\n },\n {\n \"lineItemName\": \"02 Site Utilities\",\n \"unitCost\": \"2000\",\n \"contractDetails\": {\n \"activity\": \"20_7845_9999\"\n },\n \"additionalCoding\": {\n \"workOrderNumber\": \"2\"\n }\n }\n ]\n }\n }\n}
So here, I tried many a ways to manipulate the BOMA value which should come as distinct, the way it shows up in input, like for item 1 we have value available but for item 2 we should get null (or any other value, as coming from source), but the final working mapping I could figure out is mentioned above and it's basically mapping first BOMA code encountered in all the list object values.
Appreciate any help here!
Please let me know in case additional details needed here.
Thanks,
Deepti
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"213","kudosSumWeight":0,"postTime":"2023-11-20T22:55:58.165-08:00","lastPublishTime":"2023-11-20T22:55:58.165-08:00","metrics":{"__typename":"MessageMetrics","views":3601},"visibilityScope":"PUBLIC","placeholder":false,"showMoveIndicator":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"MessageEdge","cursor":"MjUuOHwyLjF8b3wzfDE0OjAsMzk6MXwx","node":{"__ref":"ForumReplyMessage:message:24398"}}]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}}},"ModerationData:moderation_data:24398":{"__typename":"ModerationData","id":"moderation_data:24398","status":"UNMODERATED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"ForumReplyMessage:message:24398":{"__typename":"ForumReplyMessage","author":{"__ref":"User:user:1145"},"id":"message:24398","entityType":"FORUM_REPLY","eventPath":"category:platform/category:products/community:iaudz84835board:pipelines/message:24339/message:24398","revisionNum":2,"uid":24398,"depth":2,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:pipelines"},"parent":{"__ref":"ForumReplyMessage:message:24384"},"conversation":{"__ref":"Conversation:conversation:24339"},"subject":"Re: Retrieve a list within another array list","moderationData":{"__ref":"ModerationData:moderation_data:24398"},"body":"Hi Deepti ,
Good day. Hope this helps
{'order':{'orderLineItems': {'orderLineItem': $items.map( i=> { 'lineItemName': i.get('description'), 'unitCost': i.get('unitPrice'), 'contractDetails': { 'activity': ''.concat('20_', (i['projectActivity'].get('chartCodes',[]).find((x,y,z)=> x.get('chartCode',{}).get('supplementalType','') == 'BOMA') || {}).get('chartCode',{}).get('uniqueCode','null'), '_9999')}, 'additionalCoding': {'workOrderNumber': $project.get('projectId')} })}}}
Thanks,
EmEm
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"226","kudosSumWeight":0,"repliesCount":0,"postTime":"2023-11-21T23:10:32.763-08:00","lastPublishTime":"2023-11-22T03:53:18.968-08:00","metrics":{"__typename":"MessageMetrics","views":3579},"visibilityScope":"PUBLIC","placeholder":false,"showMoveIndicator":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}}},"ModerationData:moderation_data:24387":{"__typename":"ModerationData","id":"moderation_data:24387","status":"UNMODERATED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"ForumReplyMessage:message:24387":{"__typename":"ForumReplyMessage","uid":24387,"id":"message:24387","entityType":"FORUM_REPLY","eventPath":"category:platform/category:products/community:iaudz84835board:pipelines/message:24339/message:24387","revisionNum":1,"author":{"__ref":"User:user:168"},"readOnly":false,"repliesCount":1,"depth":1,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:pipelines"},"parent":{"__ref":"ForumTopicMessage:message:24339"},"conversation":{"__ref":"Conversation:conversation:24339"},"subject":"Re: Retrieve a list within another array list","moderationData":{"__ref":"ModerationData:moderation_data:24387"},"body":"Deepti - please unzip and import the attached pipeline. Since you are already familiar with jsonPath and Array functions, I will not go into detail on the solution. Please let me know if you have any questions.
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"218","kudosSumWeight":0,"postTime":"2023-11-21T09:00:44.231-08:00","lastPublishTime":"2023-11-21T09:00:44.231-08:00","metrics":{"__typename":"MessageMetrics","views":2235},"visibilityScope":"PUBLIC","placeholder":false,"showMoveIndicator":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[{"__typename":"MessageEdge","cursor":"MjUuOHwyLjF8b3wzfDE0OjAsMzk6MXwx","node":{"__ref":"ForumReplyMessage:message:24415"}}]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[{"__typename":"AttachmentEdge","cursor":"MjUuOHwyLjF8b3w1fF9OVl98MQ","node":{"__ref":"Attachment:{\"id\":\"attachment:message24387AttachmentNumber1\",\"url\":\"https://community.snaplogic.com/t5/s/iaudz84835/attachments/iaudz84835/pipelines/14511/1/Community%2024384%20-%20Retrieve%20a%20list%20within%20an%20array_2023_11_21.zip\"}"}}],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}}},"ModerationData:moderation_data:24415":{"__typename":"ModerationData","id":"moderation_data:24415","status":"UNMODERATED","rejectReason":null,"isReportedAbuse":false,"rejectUser":null,"rejectTime":null,"rejectActorType":null},"ForumReplyMessage:message:24415":{"__typename":"ForumReplyMessage","author":{"__ref":"User:user:4931"},"id":"message:24415","entityType":"FORUM_REPLY","eventPath":"category:platform/category:products/community:iaudz84835board:pipelines/message:24339/message:24415","revisionNum":1,"uid":24415,"depth":2,"hasGivenKudo":false,"subscribed":false,"board":{"__ref":"Forum:board:pipelines"},"parent":{"__ref":"ForumReplyMessage:message:24387"},"conversation":{"__ref":"Conversation:conversation:24339"},"subject":"Re: Retrieve a list within another array list","moderationData":{"__ref":"ModerationData:moderation_data:24415"},"body":"Hi koryknick ,
Thanks for your response, and I understood the solution provided, was following same path but couldn't make it work. However, I need to tweek this a bit further where I would need this projectid coming from outside also being mapped in items array list.
{\n \"order\": {\n \"orderLineItems\": {\n \"orderLineItem\": [\n {\n \"lineItemName\": \"Architecture Fees\",\n \"unitCost\": \"1000\",\n \"contractDetails\": {\n \"activity\": \"20_7845_9999\",\n \"workOrderNumber\": \"2\"\n },\n \"additionalCoding\": {\n \"workOrderNumber\": \"2\"\n }\n },\n {\n \"lineItemName\": \"02 Site Utilities\",\n \"unitCost\": \"2000\",\n \"contractDetails\": {\n \"activity\": \"20_null_9999\",\n \"workOrderNumber\": \"2\"\n },\n \"additionalCoding\": {\n \"workOrderNumber\": \"2\"\n }\n }\n ]\n }\n }\n}
So, if I want the output to look like this instead (where we have some elements from inside list and some from outside), then how will we achieve that as this is just the snippet of what I was looking for but, in reality I do need to combine some inside and outside array list objects. Looking forward to hearing back from you.
Thanks & Regards,
Deepti
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"208","kudosSumWeight":0,"repliesCount":0,"postTime":"2023-11-26T23:46:43.031-08:00","lastPublishTime":"2023-11-26T23:46:43.031-08:00","metrics":{"__typename":"MessageMetrics","views":2222},"visibilityScope":"PUBLIC","placeholder":false,"showMoveIndicator":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[]},"customFields":[],"attachments":{"__typename":"AttachmentConnection","edges":[],"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}}},"QueryVariables:MessageSolutions":{"__typename":"QueryVariables","id":"MessageSolutions","value":{"first":10,"constraints":{"topicId":{"eq":"message:24339"},"solution":{"eq":true}},"sorts":{"postTime":{"direction":"ASC"}},"useAvatar":true,"useAuthorLogin":true,"useAuthorRank":false,"useBody":true,"useKudosCount":false,"useTimeToRead":false,"useMedia":true,"useRepliesCount":false,"useSearchSnippet":false,"useAcceptedSolutionButton":true,"useSolvedBadge":false,"useAttachments":true,"useTags":false,"useUserHoverCard":false,"useNodeHoverCard":false,"usePreviewSubjectModal":false,"useMessageStatus":false}},"CachedAsset:text:en_US-components/community/NavbarDropdownToggle-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/community/NavbarDropdownToggle-1757776824711","value":{"ariaLabelClosed":"Press the down arrow to open the menu"},"localOverride":false},"CachedAsset:text:en_US-components/messages/EscalatedMessageBanner-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/EscalatedMessageBanner-1757776824711","value":{"escalationMessage":"Escalated to Salesforce by {username} on {date}","viewDetails":"View Details","modalTitle":"Case Details","escalatedBy":"Escalated by: ","escalatedOn":"Escalated on: ","caseNumber":"Case Number: ","status":"Status: ","lastUpdateDate":"Last Update: ","automaticEscalation":"automatic escalation","anonymous":"Anonymous"},"localOverride":false},"CachedAsset:text:en_US-components/users/UserLink-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/users/UserLink-1757776824711","value":{"authorName":"View Profile: {author}","anonymous":"Anonymous"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/users/UserRank-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserRank-1757776824711","value":{"rankName":"{rankName}","userRank":"Author rank {rankName}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageTime-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageTime-1757776824711","value":{"postTime":"Published: {time}","lastPublishTime":"Last Update: {time}","conversation.lastPostingActivityTime":"Last posting activity time: {time}","conversation.lastPostTime":"Last post time: {time}","moderationData.rejectTime":"Rejected time: {time}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSolvedBadge-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSolvedBadge-1757776824711","value":{"solved":"Solved"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSubject-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSubject-1757776824711","value":{"noSubject":"(no subject)"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageBody-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageBody-1757776824711","value":{"showMessageBody":"Show More","mentionsErrorTitle":"{mentionsType, select, board {Board} user {User} message {Message} other {}} No Longer Available","mentionsErrorMessage":"The {mentionsType} you are trying to view has been removed from the community.","videoProcessing":"Video is being processed. Please try again in a few minutes.","bannerTitle":"Video provider requires cookies to play the video. Accept to continue or {url} it directly on the provider's site.","buttonTitle":"Accept","urlText":"watch"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageCustomFields-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageCustomFields-1757776824711","value":{"CustomField.default.label":"Value of {name}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageReplyButton-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageReplyButton-1757776824711","value":{"repliesCount":"{count}","title":"Reply","title@board:BLOG@message:root":"Comment","title@board:TKB@message:root":"Comment","title@board:IDEA@message:root":"Comment","title@board:OCCASION@message:root":"Comment"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSolutionList-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSolutionList-1757776824711","value":{"emptyDescription":"No has been message solutions yet"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageListMenu-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageListMenu-1757776824711","value":{"postTimeAsc":"Oldest","postTimeDesc":"Newest","kudosSumWeightAsc":"Least Liked","kudosSumWeightDesc":"Most Liked","sortTitle":"Sort By","sortedBy.item":" { itemName, select, postTimeAsc {Oldest} postTimeDesc {Newest} kudosSumWeightAsc {Least Liked} kudosSumWeightDesc {Most Liked} other {}}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/AcceptedSolutionButton-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/AcceptedSolutionButton-1757776824711","value":{"accept":"Mark as Solution","accepted":"Marked as Solution","errorHeader":"Error!","errorAdd":"There was an error marking as solution.","errorRemove":"There was an error unmarking as solution.","solved":"Solved","topicAlreadySolvedErrorTitle":"Solution Already Exists","topicAlreadySolvedErrorDesc":"Refresh the browser to view the existing solution"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/common/Pager/PagerLoadMore-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/common/Pager/PagerLoadMore-1757776824711","value":{"loadMore":"Show More"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageView/MessageViewInline-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageView/MessageViewInline-1757776824711","value":{"bylineAuthor":"{bylineAuthor}","bylineBoard":"{bylineBoard}","anonymous":"Anonymous","place":"Place {bylineBoard}","gotoParent":"Go to parent {name}"},"localOverride":false},"Attachment:{\"id\":\"attachment:message24387AttachmentNumber1\",\"url\":\"https://community.snaplogic.com/t5/s/iaudz84835/attachments/iaudz84835/pipelines/14511/1/Community%2024384%20-%20Retrieve%20a%20list%20within%20an%20array_2023_11_21.zip\"}":{"__typename":"Attachment","id":"attachment:message24387AttachmentNumber1","filename":"Community 24384 - Retrieve a list within an array_2023_11_21.zip","filesize":1734,"contentType":"application/zip","url":"https://community.snaplogic.com/t5/s/iaudz84835/attachments/iaudz84835/pipelines/14511/1/Community%2024384%20-%20Retrieve%20a%20list%20within%20an%20array_2023_11_21.zip"},"CachedAsset:text:en_US-shared/client/components/users/UserAvatar-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserAvatar-1757776824711","value":{"altText":"{login}'s avatar","altTextGeneric":"User's avatar"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/ranks/UserRankLabel-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/ranks/UserRankLabel-1757776824711","value":{"altTitle":"Icon for {rankName} rank"},"localOverride":false},"CachedAsset:text:en_US-components/common/ExternalLinkWarningModal-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/common/ExternalLinkWarningModal-1757776824711","value":{"title":"Leaving the Community","description":"You're about to leave this site and navigate to an external domain. Are you sure you want to continue?","action.submit":"Continue","action.cancel":"Go Back"},"localOverride":false},"CachedAsset:text:en_US-components/attachments/AttachmentView/AttachmentViewChip-1757776824711":{"__typename":"CachedAsset","id":"text:en_US-components/attachments/AttachmentView/AttachmentViewChip-1757776824711","value":{"errorTitle":"Failed!","previewFile":"Preview File","downloadFile":"Download File {name}","removeFile":"Remove File {name}","errorBadExtension":"This file does not have a valid extension. \"{extensions}\" are the valid extensions.","errorFileEmpty":"This file is empty or does not exist.","errorTooLarge":"The maximum file size is: {maxFileSize}.","errorTooMany":"Too many attachments. The maximum number of attachments per message is: {maxAttachmentCount, number, integer}.","errorDuplicate":"This file is already attached."},"localOverride":false}}}},"page":"/forums/ForumMessagePage/ForumMessagePage","query":{"boardId":"pipelines","messageSubject":"retrieve-a-list-within-another-array-list","messageId":"24339"},"buildId":"WM9SdYbkBOUO6CupNKc_7","runtimeConfig":{"buildInformationVisible":false,"logLevelApp":"info","logLevelMetrics":"info","surveysEnabled":true,"openTelemetry":{"clientEnabled":false,"configName":"snaplogic","serviceVersion":"25.8.0","universe":"prod","collector":"http://localhost:4318","logLevel":"error","routeChangeAllowedTime":"5000","headers":"","enableDiagnostic":"false","maxAttributeValueLength":"4095"},"apolloDevToolsEnabled":false,"quiltLazyLoadThreshold":"3"},"isFallback":false,"isExperimentalCompile":false,"dynamicIds":["components_seo_QAPageSchema","components_community_Navbar_NavbarWidget","components_community_Breadcrumb_BreadcrumbWidget","components_messages_TopicWithThreadedReplyListWidget","components_messages_MessageListForNodeByRecentActivityWidget","components_customComponent_CustomComponent","components_community_FooterWidget","components_messages_MessageView_MessageViewStandard","components_messages_ThreadedReplyList","components_external_components_ExternalComponent","components_community_FooterWidgetHelpLink","components_community_KhorosLogo","components_messages_EscalatedMessageBanner","shared_client_components_common_List_UnstyledList","components_messages_MessageView","shared_client_components_common_Pager_PagerLoadMore","shared_client_components_common_List_ListGroup","components_messages_MessageView_MessageViewInline","components_customComponent_CustomComponentContent_TemplateContent","shared_client_components_common_List_UnwrappedList","components_attachments_AttachmentView","components_attachments_AttachmentView_AttachmentViewChip"],"appGip":true,"scriptLoader":[]}