Skip to content

Instantly share code, notes, and snippets.

@islaytitans
Last active February 27, 2016 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save islaytitans/b879575dc4df00f3e258 to your computer and use it in GitHub Desktop.
Save islaytitans/b879575dc4df00f3e258 to your computer and use it in GitHub Desktop.
Populate the results from the Query to populate the results table
public class PopulateSampleOrdersWithXdbData : ReportProcessorBase
{
public override void Process(ReportProcessorArgs args)
{
DataTable queryResult = args.QueryResult;
DataTable resultTableForView = args.ResultTableForView;
ProjectRawTableIntoResultTable(args, queryResult, resultTableForView);
}
private void ProjectRawTableIntoResultTable(ReportProcessorArgs args, DataTable rawTable, DataTable resultTable)
{
foreach (DataRow sourceRow in DataTableExtensions.AsEnumerable(rawTable))
{
DataRow dataRow = resultTable.NewRow();
TryFillData<Guid>(dataRow, new ViewField<Guid>("ContactId"), sourceRow, "ContactId");
TryFillData<Guid>(dataRow, new ViewField<Guid>("VisitId"), sourceRow, "_id");
TryFillData<int>(dataRow, new ViewField<int>("VisitIndex"), sourceRow, "LatestVisitIndex");
TryFillData<DateTime>(dataRow, new ViewField<DateTime>("VisitStartDateTime"), sourceRow, "StartDateTime");
TryFillData<string>(dataRow, new ViewField<string>("RangeId"), sourceRow, "RangeId");
TryFillData<string>(dataRow, new ViewField<string>("DecorId"), sourceRow, "DecorId");
resultTable.Rows.Add(dataRow);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment