Profile Picture

merge data from multiple tables of dataset using NRichTextViewWithCommandBars

Posted By Mike Willis 6 Years Ago
Author
Message
Mike Willis
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 18, Visits: 109
I am using Nevron Open Vision for .NET Enterprise 2017.1

I have a requirement to merge data from multiple tables in a dataset (c# DataSet class).
Additionally to merge all rows from a table in the dataset.
Does RichTextView support this type of merging/

If not can i write a custom mailmerge class derived from NMailMerge and NDataSource?
Or
Can i override or add custom types to the Insert Field dialog , and process these fields myself?

Thanks in advance
Mike Willis




Mike Willis
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 18, Visits: 109
Was also looking at this as a solution?
When needed you can easily add support for more formats by implementing the abstract NDataSourceFormat class and registering your data source format using its static Register method.
http://helpopenvision.nevron.com/#MailMergeDataSources.html
Mike

Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,000
Hi,

The NOV rich text view uses the data rows from a single data table for mail merge. If you want to merge data rows from multiple data tables it is best to merge them into a single data table first and then pass this merged data table as data source for mail merge to the NOV rich text view. You can do this by creating a class that inherits NMailMergeDataSource, overriding its GetDataTable method to return your merged data table and assigning an instance of this class to the DataSource property of the rich text document block's mail merge object like shown below:

richTextView.Content.MailMerge.DataSource = dataSource;


Please note that Nevron Open Vision uses its own data API (i.e. custom implementation of data sets and data tables), which is the only way to make the data layer of your application truly cross-platform. For more information about the data tables in NOV (NDataTable) check out the Data Tables documentation topic.

Best Regards,
Nevron Support Team



Mike Willis
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 18, Visits: 109
Thanks!  When deriving from NMailMergeDataSource 
The compiler requires the implementation of Wwr() and Xwr().
When those are implemented the compiler then complains "No suitable method to override"
I don't find the methods Wwr() and Xwr() in the inheritance chain either.
Code below.  Any suggestions?

public class DocumentMergeDataSource:NMailMergeDataSource
  {
   public override NDataTable GetDataTable()
   {
    DocumentDataSet ds = new DocumentDataSet();
    return ds.DocumentToNDataTable();

   }

   internal override string Wwr()
   {
    throw new NotImplementedException();
   }

   internal override string Xwr()
   {
    throw new NotImplementedException();
   }
  }


Mike Willis
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 18, Visits: 109
Hey,
Attempting to do as you suggest "by creating a class that inherits NMailMergeDataSource, overriding its GetDataTablecreate a class that inherits from NMailMergeDataSource."
However i get these compiler errors
ErrorCS0115'DocumentMergeDataSource.Xwr()': no suitable method found to override
ErrorCS0115'DocumentMergeDataSource.Wwr()': no suitable method found to override
ErrorCS0534'DocumentMergeDataSource' does not implement inherited abstract member 'NMailMergeDataSource.Xwr()'
ErrorCS0534'DocumentMergeDataSource' does not implement inherited abstract member 'NMailMergeDataSource.Wwr()'

this is the code
"public class MyMailMergeDataSource : NMailMergeDataSource
  {
   public override NDataTable GetDataTable()
   {
    Business.DocumentDataSet ds = new Business.DocumentDataSet();
    return ds.DocumentToNDataTable();

   }

   internal override string Wwr()
   {
    throw new NotImplementedException();
   }

   internal override string Xwr()
   {
    throw new NotImplementedException();
   }
  }"


Mike Willis
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 18, Visits: 109
Changed inheritance  to NMemoryMailMergeDataSource

Mike Willis
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 18, Visits: 109
After changing the base class to NMemoryMailMergeDataSource, i receive object not set to instance of object error.
Event this simple class gives an error.
public class TestMergeDataSource:NMemoryMailMergeDataSource
  {

  }"
need more assistance!
Mike

Nevron Support
Posted 6 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,000
You can use the NMemoryMailMergeDataSource directly without creating a class that inherits it. Simply create an NMemoryDataTable with the data you want to use for mail merge and pass it to the constructor of NMemoryMailMergeDataSource that accepts a data table:

richTextView.Content.MailMerge.DataSource = new NMemoryMailMergeDataSource(dataTable);



Best Regards,
Nevron Support Team



Mike Willis
Posted 6 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 18, Visits: 109
Had to add the following to my class
public static readonly NSchema NDatsMailMergeDataSourceSchema;
   static DatsMailMergeDataSource()
   {
    NDatsMailMergeDataSourceSchema = NSchema.Create(typeof(DatsMailMergeDataSource), NMemoryMailMergeDataSource.NMemoryMailMergeDataSourceSchema);
   }




Similar Topics


Reading This Topic