Telerik CsvDataSource - how do I find it? - Forum - OpenEdge Development - Progress Community

Telerik CsvDataSource - how do I find it?

 Forum

Telerik CsvDataSource - how do I find it?

  • Hi Bill, to be precise… the first time you reference a .NET class name in an ABL compile unit (.p/.cls) you have to be case-sensitive. From there on the ABL relaxes this requirement.
     
     
    Von: Bill Wood [mailto:bounce-wood@community.progress.com]
    Gesendet: Freitag, 6. Februar 2015 09:59
    An: TU.OE.Development@community.progress.com
    Betreff: RE: [Technical Users - OE Development] Telerik CsvDataSource - how do I find it?
     
    Reply by Bill Wood

    FYI...  on the last post I had incorrectly talked about case-sensitivity.   For .NET Classes, the ABL is case-insensitive.  You don't need to match the case when you reference classes.

    (Also, I noted a few typos in my code sample which I corrected.)

    Stop receiving emails on this subject.

    Flag this post as spam/abuse.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  •   DEFINE PUBLIC  VARIABLE myDataSource AS Telerik.Reporting.CsvDataSource NO-UNDO.
      DEFINE PUBLIC  VARIABLE report AS Telerik.Reporting.Report NO-UNDO.
    :
    :
        report = new Telerik.Reporting.Report().
        myDataSource = new Telerik.Reporting.CsvDataSource().
        myDataSource = CAST(report:DataSource, myDataSource).
        myDataSource:Source = new Uri("c:\Users\Temp\slettme2.csv").
     
    This is how I understood what you said. This will not work. It says:
     
     
  • The cast is wrong:
     
        myDataSource = CAST(report:DataSource, myDataSource).
     
    Try:
     
        myDataSource = CAST(report:DataSource, Telerik.Reporting.CsvDataSource).
     
    The second argument of the CAST needs to be a class name.
     
     
    Von: goo [mailto:bounce-goo@community.progress.com]
    Gesendet: Freitag, 6. Februar 2015 13:19
    An: TU.OE.Development@community.progress.com
    Betreff: [Technical Users - OE Development] SV: Telerik CsvDataSource - how do I find it?
     
    Reply by goo
      DEFINE PUBLIC  VARIABLE myDataSource AS Telerik.Reporting.CsvDataSource NO-UNDO.
      DEFINE PUBLIC  VARIABLE report AS Telerik.Reporting.Report NO-UNDO.
    :
    :
        report = new Telerik.Reporting.Report().
        myDataSource = new Telerik.Reporting.CsvDataSource().
        myDataSource = CAST(report:DataSource, myDataSource).
        myDataSource:Source = new Uri("c:\Users\Temp\slettme2.csv").
     
    This is how I understood what you said. This will not work. It says:
     
    Fra: Bill Wood [mailto:bounce-wood@community.progress.com]
    Sendt: 6. februar 2015 07:09
    Til: TU.OE.Development@community.progress.com
    Emne: RE: [Technical Users - OE Development] Telerik CsvDataSource - how do I find it?
     
    Reply by Bill Wood

    Can you share the error message?   I am wondering if you have the correct "USING" statement.   The code above where you CAST (myReportDataSource, CsvDataSource) only works if the namespace for CsvDataSource can be resolved.  

    The full class name is "Telerik.Reporting.CsvDataSource"

    There is a section in the OpenEdge online documentation in this: C# .NET code mapped to OpenEdge GUI for .NET ABL

    You want to look at the section on Casting.   Approximately, your code should look like.

    USING Telerik.Reporting.
     
    DEFINE PUBLIC VAR myReport Report NO-UNDO.
    DEFINE PUBLIC VAR csvDataSource AS CsvDataSource NO-UNDO.
     
    myReport = new Report().
    csvDataSource = CsvDataSource().
     
    csvDataSource = CAST(myReport:DataSource, CsvDataSource).


    (Note: in your cut/pasted code, you also had referred to the CvsDataSource CLASS as 'Telerik.Reporting.cvsDataSource" with different capitalization.    For .NET components, the case is important.  If you could share the error, it might point to which one of the above problems you were running into.)

    Stop receiving emails on this subject.

    Flag this post as spam/abuse.


    No virus found in this message.
    Checked by AVG - www.avg.com
    Version: 2015.0.5646 / Virus Database: 4273/9047 - Release Date: 02/02/15
    Stop receiving emails on this subject.

    Flag this post as spam/abuse.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • Thanks for the error message.

    The issue is that you are trying to use CAST (object, class) with two objects.  The second paramter is not the 'instance', but the class reference.   Thjis is definitely not 'obvious' if you are not used to OOABL programming and .NET.

    You had:

    myDataSource = CAST(report:DataSource, myDataSource).    

    You want:

    myDataSource = CAST(report:DataSource, Telerik.Reporting.CvsDataSource).

    The code sample in the forum post earlier shows a more complete sample (Look at in in a browser, The content was edited after the post so the email content is out of date)

  • Hi,

    I am catching up with the ABL syntax, so here is a runnable tested ABL version of the originally provided code (Sample 1, 2, 3)

    Note that you need to replace the actual paths to your report definition and runtime csv data.

    
    
            /* Deserialize the report instance from the report definition trdx */        
            DEFINE VARIABLE xmlSettings AS System.Xml.XmlReaderSettings.
            xmlSettings = NEW System.Xml.XmlReaderSettings().
            xmlSettings:IgnoreWhitespace = TRUE.
            DEFINE VARIABLE xmlReader AS System.Xml.XmlReader.
            xmlReader = System.Xml.XmlReader:Create("C:\Work\Research\trdx\CsvReport.trdx", xmlSettings).
            DEFINE VARIABLE xmlSerializer AS Telerik.Reporting.XmlSerialization.ReportXmlSerializer.
            xmlSerializer = NEW Telerik.Reporting.XmlSerialization.ReportXmlSerializer().
            DEFINE VARIABLE reportInstance AS Telerik.Reporting.Report.
            reportInstance = CAST(xmlSerializer:Deserialize(xmlReader), Telerik.Reporting.Report).
            xmlReader:Dispose().
    
            /* Modify the report instance as needed */
            
            DEFINE VARIABLE csvDataSource AS Telerik.Reporting.CsvDataSource.
            csvDataSource = CAST(reportInstance:DataSource, Telerik.Reporting.CsvDataSource).
            csvDataSource:Source = NEW System.Uri("C:\Work\Research\trdx\ds.txt").
            
            
            /* Use the modified in-memory report definition in my app */
            DEFINE VARIABLE instanceReportSource AS Telerik.Reporting.InstanceReportSource.
            instanceReportSource = NEW Telerik.Reporting.InstanceReportSource().
            instanceReportSource:ReportDocument = reportInstance.
            THIS-OBJECT:reportViewer1:ReportSource = instanceReportSource.
            THIS-OBJECT:reportViewer1:RefreshReport().


    Hope this helps.

    Milen