Beginner question with SQLLite

Posted by: eric33 on 3 August 2017, 3:49 pm EST

  • Posted 3 August 2017, 3:49 pm EST

    We are very interested by the product but i am a beginner with this type of product.



    I have a SQLlite database with some trending value and want to make some analysis on it (for example displaying a chart on a year).



    What is the simple way to reach this ?



    Thanks
  • Replied 3 August 2017, 3:49 pm EST

    Eric33,
    You can bind ddAnalysiss to a SQLite database by first setting up an RdDataSource object with a connection type (I used ODBC in my testing), the connection string, and the SQL Query that will return all of the fields you wish to have available in the schema.  Once this is setup you will need to create a schema file which can be automatically generated with the following C# code:
        DataDynamics.Analysis.Schema.SchemaBuilder sb = DataDynamics.Analysis.Schema.SchemaBuilder.AutoGenerate("SchemaName",new System.Data.Odbc.OdbcConnection(connectionString),sqlQuery);
    sb.Save(Application.StartupPath + "\\myschema.schema");

    If you would like to make any modifications or additions to the schema, you would to do so before saving the schema to a file. Once you have generated the file, you will need to provide your RdDataSource instance's CustomSchemaFile property with the file's location and name.  Then you can assign the RdDataSource to the PivotView's DataSource property and then use the datasource's connect method to open a connection to the database.  Once the pivot view is bound the database, you can create the chart based on time by either dragging and dropping the fields to the shelves you want them on (i.e. your date field and a measure field), or you can do so programmatically by using an instance of the ILayoutActions interface to call methods that will place fields on the shelves.  The following C# code demonstrates how to modify the pivot view layout to create a line chart of TotalSales over Years:

        DataDynamics.Analysis.Estensions.Schema.SchemaDefinition schema = this.pivotView1.DataSource.Schema;
        this.pivotView1.BeginLayoutUpdate("Setup")
                .SetMarkingType(DataDynamics.Analysis.DataViewModel.MarkingType.Line)
                .AppendField(schema.Get("[SalesDate].[Year]"), DataDynamics.Analysis.LayoutActions.Shelf.Column)
                .AppendField(schema.Get("[Measures].[TotalSales]"), DataDynamics.Analysis.LayoutActions.Shelf.Row)
                .Commit();

    I have also attached a sample project that connects to a simple SQLite database that demonstrates how to connect to SQLite, generate a schema (with a custom calculated field), and apply the layout modification from above.  If you have any further questions please feel free to let me know.

    2008/04/ddAnalysis-SQLite.zip
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels