Pass RDD Criteria data to SSRS Report

I have a report that I created an RDD and Report Style for. The RDD has a criteria set with mappings to parameters in the underlying BAQ. The report works just fine, but I want to pass one of the user entered parameters into the SSRS report for display. The item I want to see is not contained within the query output but is buried within a subquery in the BAQ. I tried to put the data into the CallContextBPMData Date01 field but it isn’t going over to the SSRS report. Here is the code I added to the report form to try to set the Date01 field:

private void DynamicCriteriaReportForm_AfterToolClick(object sender, Ice.Lib.Framework.AfterToolClickEventArgs args)
{
	if (args.Tool.Key == "PrintClientTool" || args.Tool.Key == "PrintServerTool" ||
			args.Tool.Key == "PrintPreviewTool" ||args.Tool.Key == "GenerateTool" )
	{
		DateTime testDate = (DateTime)dtWEDate.Value;
        MessageBox.Show(testDate.ToString("ddMMyyyy"));
		((EpiDataView)oTrans.EpiDataViews["CallContextBpmData"]).dataView.Table.Rows[0]["Date01"] = testDate;		
	}	
}

The dtWEDate field is the date entry on the form. How do I get this into the report? Am I using the wrong method to pass it?

Did you look at:

edit

Or maybe it is as simple as using the BeforeToolClick() event. That way the CallContextBPM Data is set before the print function fires. Do a trce to be sure.

I did have it in the BeforeToolClick() event and it didn’t work there either. I am confused about adding a text box bound to the CallContextBPMData since the date field is already bound to the report criteria. I have the CallContextBPMData dataset in my report so I can see the Date01 field, but the data isn’t going across to it. That is why I was trying to set it through code.

That other topic was about adding a value to pass to the SSRS report. For either just displaying in the report or for having it actually affect the data used by the report.

I’m guessing you have a value that a user enters into a “built-in” control that is used by the RDD as criteria. And that you want that value entered to be available in the SSRS. Like to display in the header, so as to show the parameters used.

So you want to copy the value of that built-in control to the CallContextBPMData. Then in the RDL, just add the CallContextBPMData_GUID table to the query expression. Or add it as a separate dataset if you don’t need to use it in the main dataset.

edit

Does the RDD version of a BAQ Report not have the BAQReportResults “table”?

Edit #2

The following is from a topic related to accessing RDD based criteria:

Yes your first 2 statements are correct. The code I posted is copying the date value from the control on the report form into the CallContextBPMData. I can see the proper value in the MessageBox that is being displayed but the Date01 in the report has nothing in it.
The RDD has the output of my BAQ even though it is not called BAQReportResults.
I tried to connect the data in the fashion described in your edit #2 but that still didn’t work. Here is what my query looks like:
=“SELECT T1.[Calculated_ETC], T1.[Calculated_TotalActualHours], T1.[Calculated_Variance], T1.[Calculated_EAC], T1.[Calculated_CobraResource], T1.[JobOper_BACHours_c], T1.[JobOper_ProdStandard], T1.[ProjPhase_PartNum], T1.[ProjPhase_ProjectID], T1.[ProjPhase_UserMapData], T1.[ProjPhase_WBS_CLIN_c], T1.[ProjPhase_WBS_Task_c], T1.[ProjPhase_WBSCodeID_Component_c], T1.[ProjPhase_WBSCodeID_Device_c], T1.[ProjPhase_WBSCodeID_Element_c], T1.[ProjPhase_WBSCodeID_Function_c], T1.[ProjPhase_WBSCodeID_Phase_c]
, T2.Date01 FROM
ETCEAC_” + Parameters!TableGuid.Value + " as T1
" + " JOIN dbo.[CallContextBpmData_" + Parameters!TableGuid.Value + “] AS T2 ON 1=1”

Have I done it right? Not sure I understand what the ON 1=1 is doing.

Yeah, the BAQReportResults is from the old (non-RDD) BAQ Reports.

I think the “1=1” is just to force the join without specifying any fields.

Does your report (with the query expression in your post above) not run? Or does it run but the T2.Date01 value is blank?

Some debugging methods:

  1. Run your code as is, but don’t acknowledge the MessageBox for a minute or so. Note the time when you do. Then quickly check the system monitor to see when the task to create the report was created. If the task is created before you acknowledge the MessageBox, then your code has missed its chance to set the CCBD (CallContextBPMData)

  2. Update the if(args…) block to:

     {
     DateTime testDate = (DateTime)dtWEDate.Value;
     MessageBox.Show(testDate.ToString("ddMMyyyy");
     ((EpiDataView)oTrans.EpiDataViews["CallContextBpmData"]).dataView.Table.Rows[0]["Date01"] = testDate;	

     // new for debugging
     DateTime testDate2=((EpiDataView)oTrans.EpiDataViews["CallContextBpmData"]).dataView.Table.Rows[0]["Date01"];
     MessageBox.Show(testDate2.ToString("ddMMyyyy");
     }

Just to make sure the CCBD is getting set.

  1. Set the CCBD element to some constant in the FormLoad() event. This is to see if maybe your code isn’t getting run until after the the report is already submitted.

I did all 3 suggestions. Number 1 did show the value is being set before the report is generated. Number 2 showed that it is being set in the code. Number 3 showed no effect.

I think the bottom line is that I am not connecting to the CCBD somehow in the report. No matter what I do the data does not show up.

Oh, and I changed from the Date01 to Character01 to see if it was something funky with the date but still nothing.

Do you have access to the SQL server?

If so, run the report again with the archive set to 1 day. Next use the system monitor to find the GUID for the report. Now look for the table CallContextBPMData_<GUID> in the SSRS SQL DB. Use SSMS to inspect it and look to see if it has the value you want.

Edit

Or perhaps first just enable tracing (including CCBD) to see if the CCBD is getting set

When I look at the table on the SQL Server there is nothing in the record, so I have to assume I am not setting what I think I am. I tried to look at the trace log but I am not sure what to look for but I didn’t see anything like “Character01”. It only appeared to be writing out the SysRowID value. I have to assume I am not binding to the CCBD properly.

I found this code online:
using Ice.Bpm.Context;
using Erp.Adapters;

using (var adapter = new QuoteAdapter(this.oTrans))
{
adapter.BOConnect();
adapter.BpmContext = new ContextDataSet();
var row = adapter.BpmContext.BpmData.NewRow();
row[“Number01”] = ;
row[“Checkbox01”] = ;
row[“SysRowID”] = Guid.Empty;
adapter.BpmContext.BpmData.Rows.Add(row);

but I am not sure what adapter I need to connect to. My current code just references oTrans but I have a feeling I need the proper adapter to make this work. Any idea how I determine what adapter I need for a DynamicCriteriaReportForm?

So you did find the table CallContextBPMData_<GUID>. You say “there is nothing in the record”. But there is a record (as opposed to being completely empty), its just that the user fields (Char01, Date01, etc…) are all blank (or have default values, Number01 should be 0.0).

What is in the non-user fields fields of the record?

When doing the trace, enable tracing, complete data. In the section in the middle there are some extra options. One of them is something like Call Context Data. Enable that one too. Do the tracing in the following order:

  1. Launch the report form and fill it out - but don’t submit it yet.
  2. Exit the System Monitor (right click the icon in the systray)Enable tracing
  3. Launch the Tracing options
  4. Enable tracing, full dataset, and the CallContext BPM data options
  5. Click the Apply button
  6. Click the Clear Log button
  7. Submit the report (Previewing it should be fine)
  8. Disable the Logging
  9. View the Log - search for “CallContext”
  10. Restart the system monitor. If you don’t have access to that menu item just close and reopen the client.

Yes, when I looked in the table the only thing in the record was either default values or they were empty (null for dates).

<parameter name="agentID" type="System.String"><![CDATA[SystemAgent]]></parameter> <parameter name="agentSchedNum" type="System.Int64"><![CDATA[0]]></parameter> <parameter name="agentTaskNum" type="System.Int32"><![CDATA[0]]></parameter> <parameter name="maintProgram" type="System.String"><![CDATA[Ice.UIRpt.DynamicCriteriaReport;ETCEAC]]></parameter> <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet"> <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context"> <BpmData> <SysRowID>bcd81a46-37e1-4127-a259-ce7064e2e09b</SysRowID> </BpmData> </ContextDataSet> </parameter> </parameters>

I just did the logging as you instructed and here is the only instance of CallContext:

Not sure if it should be showing something else or not.

Did you trim the data out of your post? It might be missing because the open < and close > characters are trying to fromat your post as something else.

Try the following in your post. Add a line with three ticks and XML above the text you pasted. ``` XML And then just three ticks ``` after the pasted text. These have to be on there own lines. Your post shpould look like:

image

This will make post format like:

image

Not sure what I did wrong but the ticks didn’t work for me. However, I did put the text in as preformatted text. It’s not pretty but all of the information is there from that part of the log file.

The “ticks” are on the key with the tilde (~). Next to the 1 key.

OK - thanks for the clarification. Here is the part of the log. This is the only instance of CallContext in the log file.

    <parameter name="agentID" type="System.String"><![CDATA[SystemAgent]]></parameter>
    <parameter name="agentSchedNum" type="System.Int64"><![CDATA[0]]></parameter>
    <parameter name="agentTaskNum" type="System.Int32"><![CDATA[0]]></parameter>
    <parameter name="maintProgram" type="System.String"><![CDATA[Ice.UIRpt.DynamicCriteriaReport;ETCEAC]]></parameter>
    <parameter name="CallContext" type="Ice.Bpm.Context.ContextDataSet">
      <ContextDataSet xmlns="http://www.epicor.com/Ice/300/Bpm/Context">
        <BpmData>
          <SysRowID>bcd81a46-37e1-4127-a259-ce7064e2e09b</SysRowID>
        </BpmData>
      </ContextDataSet>
    </parameter>

“The item I want to see is not contained within the query output but is buried within a subquery in the BAQ”

Would it be simpler to include the parameter in the query output ?

I am filtering the subquery by date, then rolling up sums to give a single row of data. If I try to pass the date in the primary query I don’t get the single line of output. So I can’t include it in the query output.

You can try to pass the date in a calculated field instead of a direct reference. Heck, I’m just trying to make sure that there are no other solution than code.

1 Like

I never thought of that. I’m still new to Epicor. It was so easy to set up a calculated field and assign it to the parameter. Thanks so much!