{"id":1737,"date":"2015-09-16T12:44:28","date_gmt":"2015-09-16T07:14:28","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=1737"},"modified":"2015-09-16T12:44:28","modified_gmt":"2015-09-16T07:14:28","slug":"using-lookupset-in-ssrs-reports-to-show-activity-parties-related-to-an-activity-in-dynamics-crm","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2015\/09\/using-lookupset-in-ssrs-reports-to-show-activity-parties-related-to-an-activity-in-dynamics-crm\/","title":{"rendered":"Using LookupSet in SSRS reports to show activity parties related to an activity in Dynamics CRM"},"content":{"rendered":"<p>There are so many features of SSRS reports which are very less used but they can play a vital role in our report performance and productivity.<\/p>\n<p>One such feature of SSRS reports is <strong>LookupSet<\/strong>.<\/p>\n<p><strong>SSRS Definition:<\/strong><\/p>\n<p><strong>\u00a0<\/strong>As per SSRS documentation a LookupSet may be defined as:<\/p>\n<p>Use LookupSet to retrieve a set of values from the specified dataset for a name-value pair where there is a 1-to-many relationship.<\/p>\n<p>For example, for a customer identifier in a table, you can use LookupSet to retrieve all the associated phone numbers for that customer from a dataset that is not bound to the data region.<\/p>\n<p><strong>Explanation:<\/strong><\/p>\n<p>In SSRS reports we can bind a table to a single dataset and due to that it becomes tedious to show the records from another dataset.<\/p>\n<p>So we use LookupSet to fetch the records from another dataset based on a matching value between the current dataset and the target dataset.<\/p>\n<p>For example, if we need to show the activity parties associated with an activity then we can use the LookupSet to achieve this.<\/p>\n<p><strong>Working:<\/strong><\/p>\n<p>Since it is not possible to fetch the related activity parties associated with an activity from OOB approach as shown in the below figure.<\/p>\n<p>So we cannot fetch the To (Recipients) and From (Sender) of an activity using Advanced Find.<a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2015\/09\/ssrs.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1738\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2015\/09\/ssrs.png\" alt=\"ssrs\" width=\"408\" height=\"240\" \/><\/a><\/p>\n<p><strong><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2015\/09\/ssrs1.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1739\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2015\/09\/ssrs1.png\" alt=\"ssrs1\" width=\"409\" height=\"250\" \/><\/a><\/strong><\/p>\n<p><strong>Workaround:<\/strong><\/p>\n<p>In reports we can achieve this using LookupSet, to achieve this we created two dataset i.e. <strong>dsActivities<\/strong> and <strong>dsActivityParties<\/strong>. Both the datasets have the <strong>ActivityId<\/strong> field in common so we used the following formula to fetch the To (Recipients) and From (Sender) of the activities shown in the report.<\/p>\n<p><strong>Formula:<\/strong><\/p>\n<p><strong>To (Recipients):<\/strong><\/p>\n<p>=IIF(IsNothing(Join(LookupSet(Fields!activityid.Value, Fields!activityidValue.Value, IIF(Fields!participationtypemaskValue.Value = 2, Fields!partyid.Value, &#8220;&#8221;), &#8220;dsActivityParties&#8221;), &#8220;,&#8221;)),&#8221;&#8221;,Join(LookupSet(Fields!activityid.Value, Fields!activityidValue.Value, IIF(Fields!participationtypemaskValue.Value = 2, Fields!partyid.Value, &#8220;&#8221;), &#8220;dsActivityParties&#8221;),&#8221;, &#8220;).Trim(&#8220;, &#8220;).Trim())<\/p>\n<p><strong>From (Sender)<\/strong><\/p>\n<p>=IIF(IsNothing(Join(Lookupset(Fields!activityid.Value,Fields!activityidValue.Value,IIF(Fields!participationtypemaskValue.Value =1,Fields!partyid.Value,&#8221;&#8221;),&#8221;dsActivityParties&#8221;),&#8221;,&#8221;)),&#8221;&#8221;,Join(Lookupset(Fields!activityid.Value,Fields!activityidValue.Value,IIF(Fields!participationtypemaskValue.Value =1,Fields!partyid.Value,&#8221;&#8221;),&#8221;dsActivityParties&#8221;)))<\/p>\n<p><strong>Note:<\/strong><\/p>\n<p>Since the records returned by the LookupSet function are in the form of an Array so we use the Join function to show the record collection separated by comma (,).<\/p>\n<p><strong>Sample report:<\/strong><\/p>\n<p>After developing the report the report looks something like below:<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2015\/09\/ssrs4.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1740\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2015\/09\/ssrs4.png\" alt=\"ssrs4\" width=\"725\" height=\"159\" \/><\/a><\/p>\n<p><em>Hope it helps if you are willing to show records from different datasets in a table.<\/em><\/p>\n<p>Before you move to the next post, have you seen our new\u00a0<a href=\"http:\/\/inogic.com\/Product\/99\/Add-Ons\/Click2Export\" target=\"_blank\" rel=\"noopener noreferrer\">Click2Export<\/a>\u00a0Solution? A 1 click solution to export reports to Word\/Excel and Pdf. Email us on\u00a0<a href=\"mailto:crm@inogic.com\">crm@inogic.com<\/a>\u00a0for a trial or if you would like to see a live demo.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are so many features of SSRS reports which are very less used but they can play a vital role in our report performance and productivity. One such feature of SSRS reports is LookupSet. SSRS Definition: \u00a0As per SSRS documentation a LookupSet may be defined as: Use LookupSet to retrieve a set of values from\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2015\/09\/using-lookupset-in-ssrs-reports-to-show-activity-parties-related-to-an-activity-in-dynamics-crm\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[15,19,58],"tags":[592,1022,1666],"class_list":["post-1737","post","type-post","status-publish","format-standard","hentry","category-development","category-dynamics-crm","category-ssrs-reports","tag-dynamics-crm","tag-lookupset-in-ssrs-reports","tag-ssrs-reports"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/1737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=1737"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/1737\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=1737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=1737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=1737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}