SSRS pulling field based on value in different field

In our Quote/opp entry screen we have two Sales reps. Those fields are Primary Rep(now labeled Outsides Sales) and Insides Sales is a copy from the Primary Rep just relabeled and a different Epibinding. I am trying to make the insides sales field populate on the quote form with email address and phone number similar to how to primary rep shows up on the report. How can I make the email address pull based on the user in the insides sales field?

If you have a limited number of sales reps and are willing to maintain it going forward, you could just use Expressions or Code inside the report to do this.
Because, very generally speaking, the alternative would be to determine the source of the salesperson data in the Epicor database tables, ensure all tables are exposed in the RDD, and then write in a new join into the Dataset based on appropriate linking field values, in order to grab the email address or other saleperson specific information.

PS: Looks like all this report does, is pluck the Primary Rep by checking the occurrence based on the PrimeRep bit.

=Microsoft.VisualBasic.Interaction.IIf(First(Fields!PrimeRep.Value, "SalesPerson") = True, First(Fields!Name.Value, "SalesPerson"), Nothing)

I’m curious if you have the inside sales rep value printing successfully on the report because it is a “different Epibinding” or is the source of the inside sales rep literally the QSalesRP table.

I was also thinking about maintaining manually but would rather not do that if possible. Is their any way in the expression to say if InsideSales_c.value = true, then pull that (InsideSales_c.Value).EmailAddress.Value, else nothing??

Not sure if that’s even possible or if it makes sense.

It makes sense. So this InsideSales_c is the new bound field. It’s added into a custom RDD already too? Can I ask which Table it has been added to?

I am pretty sure it has been setup in QuotHed. When I spoke to our Consultant that made these modifications to out opp screen and created our dashboard she said she pretty much copied the primary sales rep and just changed the names. Past that I’m still a little new to Epicor. We have only been live for 1 month.

So, very generally speaking, for the data that has been added to QuoteHed, those fields need to be added to the RDD - which if it is not already, in order to do this, Epicor will require you to make a custom RDD, and in turn, a custom Report Style / SSRS RDL.
But the email address may live in a totally different table, so then you just need to establish the link from QuoteHed to the desired email address. Then in the RDL Datasets, you could construct the proper query to return the email address.
If everything was added into QuoteHed, would be simple to just include the fields onto the report.
If not, that’s where you have to construct the query to grab the email address.

I have created a custom report and custom RDD and the insides sales field should be pulling from QSalesRep same as primary rep. I’m struggling with how to right that expression to say for field inside sales give me their email. I can get the name since all I have to do is pull the inside sales value to get the name.

That the data is pulling from QSalesRep, I would insert a new text box, and a new field expression for the Inside Sales rep and use the same expression as Primary Rep, with adjustment ( False instead of True ) like so:

=Microsoft.VisualBasic.Interaction.IIf(First(Fields!PrimeRep.Value, "SalesPerson") = False, First(Fields!Name.Value, "SalesPerson"), Nothing)

This approach is problematic if there are more than 1 non-primary salesperson associated to the quote.

Otherwise, the challenge is to create or modify the Datasets to allow the direct select of the email.

Alternatively, an expression that takes the inside sales name as input, and spits out the email address - hardcoded and requires manually work to maintain as new salespersons get added.

I was assuming too, that you are trying to place this salespersons info into the page header just next to the primary salesperson that is there in the “canned” version.

Here is a screen shot of the SSRS report where I am trying to incorporate OutsideSales (PrimarySalesRep) and InsideSalesRep (our new field copied from PrimarySalesRep). I can pull the OutsideSales fields no problem but cant get the telephone and Email to pull for the insides sales person. I tried the expression above but it just gave me “!Error”. You are correct we are just trying to add the salesperson info above the primary salesperson.

Yep, on second thought, probably not as simple to just add, since there can only be “one First” record that is going to be used. Interesting that the primary rep is always “First”. Perhaps try “Last”, since in the “test case” we will assume there is an Outside and Inside sales rep always. Just as a test to prove the concept.

=Microsoft.VisualBasic.Interaction.IIf(Last(Fields!PrimeRep.Value, "SalesPerson") = False, Last(Fields!Name.Value, "SalesPerson"), Nothing)

Or,
=Microsoft.VisualBasic.Interaction.IIf(Last(Fields!PrimeRep.Value, "SalesPerson") = False, Last(Fields!SalesRepCode_EMailAddress.Value, "SalesPerson"), Nothing)

Oh, interesting, that these fields are not really inside the Page Header. This means you are not limited to aggregate references. But I suspect that not selecting the salesperson using an aggregate or to return only 1 record, would give you undesired results.