Hello,
I have a report that runs on selected Account records. You can check off certain Account records, and the report returns a list of Contacts associated with those Accounts (along with some other stuff, like certain Connections associated with those contacts).
This is currently working, but I would like to expand the report so you could run it by directly selecting the Contacts you want to see relationships for, rather than just by selecting their Accounts. It would also be nice to run this by selecting a Marketing List. Is there a way I could expand what I have so it can accept different types of records and alter my dataset logic based on the type of record it is being run on?
I based my report off this blog post, although I made some changes: http://www.kentom.co.uk/?p=353
I have a Main Report that is Fetchxml based. It takes the account records you have selected and passes the accountid as a parameter to a Subreport. (Unlike the blog post, my Subreport is actually SQL based, because I need to use unions and temp tables.) I won't bother to explain everything the subreport does, but for the sake of simplicity, let's just says my dataset in the subreport is:
Select * from contacts where accountid = @accountid
I'd like to make changes to my main report so it can accept different types of IDs, and will let me know which kind of record is being used. That way, my dataset in the Subreport could be something like this:
If (@recordType = 'Account')
Select * from contacts where accountid = @recordID
Else if (@recordType = 'Contact')
Select * from contacts where contactid = @recordID
Currently, this is what my Main Report looks like. What changes would I need to make to get something similar to the input I need to run the dataset in my Subreport?
Dataset:
<fetch distinct="false" mapping="logical" output-format="xml-platform" version="1.0">
<entity name="account" enableprefiltering="1">
<attribute name="accountid"/>
</entity>
</fetch>
Parameter:
Name: CRM_account
Default Value:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="account"><all-attributes/></entity></fetch>
Link to Subreport:
Sends as a parameter the "accountid" field from the dataset
Any help would be greatly appreciated. Thank you!
*This post is locked for comments