Examples

Posted by: danreber on 3 August 2017, 3:48 pm EST

  • Posted 3 August 2017, 3:48 pm EST

    Do you have any examples on how to create a schema file from a dataset and/or how to load the pivot grid form a dataset?


    Thanks

  • Replied 3 August 2017, 3:48 pm EST

    Also, my datasets will be cached datasets with no connection to the database, will this be allowed?



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

    Dan,
    The Windows Samples Browser samples do display some source code under the pivotview in the latest build (build 0.5.26.0). I have attached a slightly modified C# version of the In-Memory Dataset sample that uses the latest build to demonstrate building a schema with the schema builder and setting a view though code in the pivotview.

    In regards to using a cached dataset, this should not be a problem. So long as you have a dataset in memory you should be able to pass it into Analysis.

    2007/10/InMemoryDataSetModified.zip
  • Replied 3 August 2017, 3:48 pm EST

    Works great, thanks for the example.
  • Replied 3 August 2017, 3:48 pm EST

    I see the example code in your example .exe . I guess that I missed it because all but the In-memory one raises an error when I try to run it.
    2007/10/PathError.JPG
  • Replied 3 August 2017, 3:48 pm EST

    Dan,
    Thank you for bringing this to our attention.  I have entered this as Case 33749 in our system and included your email address so that when this is addressed you will be notified.  Again, thank you for your feed back.

    Please let me know if I can be of further assistance.
  • Replied 3 August 2017, 3:48 pm EST

    Dan,
    Depending on how you are setting up the dataset will determine how you can setup the schema file.  Please note that either way you will need to use the SchemaBuilder to do so.  One option would be to manually configure the schema.  We do have one sample, the “In-Memory Dataset” sample under the “Relational Data” group in the Windows Sample Browser, which demonstrates manually configuring a schema with the SchemaBuilder and setting a view in the pivot view control through code.  As well, you could generate the schema automatically by using the AutoGenerate method of the SchemaBuilder.  Please note that the AutoGenerate method returns an instance of a SchemaBuilder containing the automatically generated schema.  When doing this, you may need to go through and edit the schema slightly (i.e. reorganizing fields in dimensions, setting up hierarchies, etc.). If you are extracting the data in the dataset from a database, you can automatically generate the schema by passing the name, a connection object that connects to the database, and the SQL statement (used for the dataset) to the AutoGenerate method.  Another way you could automatically generate the schema is by passing in a name for the schema, and a generic dictionary with the TKey as String and the TValue as System.Type.  The dictionary should contain the field names as the keys and the fields’ data type as the values.  You can find more information on generic dictionaries here.

    Once the schema is setup in the SchemaBuilder, you can save the schema to a file using the SaveSchema method of the SchemaBuilder instance. Please note that it is not currently possible to open a schema file in the SchemaBuilder or as a new Schema, and that schema files are typically used to create a connection to a relational database (i.e. PivotView1.DataProvider.Connect(DataProviderType.Relational, ”SchemaFile.Schema”)).  I have entered a Case #33640 to allow for a schema file to be opened to allow editing and use in unbound mode.  I have also included your email address with this Case so that when this is addressed you will be notified.
  • Replied 3 August 2017, 3:48 pm EST

    Nickf,



    I saw the examples but they are .exe files and no source code. Are there any source code examples?



    Thanks
Need extra support?

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

Learn More

Forum Channels