Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
765
can't drag a field on the xamPivotGrid
posted

Hello,
I'm testing the controls xamPivotGrid and xamPivotDataSelector with your example solution PivotGridHostControl
(http://blogs.infragistics.com/blogs/kiril_matev/archive/2010/06/11/hosting-a-wpf-pivotgrid-delivering-advanced-data-analysis-in-your-windows-forms-application.aspx).

I Have a question:

I delete "Freight" from the "Drop Data Items Here" on the xamPivotGrid. Now I want drag the field "Freight"
from xamPivotDataSelector to "Drop Data Items Here" on the xamPivotGrid (the same place, where previously the field "Freight" had existed) . But I can't drop there the field.
I see a circle with a x.
Why it doesn't work?


Alexander

Parents
  • 1865
    Offline posted

    Hi Alexander,

    Thank you for writing us.

    The reason the pivot grid does not let you drop the Fright in the measures area, (hence the circle with an X), is that you're most probably dragging the dimension Freight, as opposed to the Freight measure, which appears in the Measures expandable group at the top of the list of measures and dimensions.

    Please drag the Fright measure from the list of measures in the pivot data selector into the measures area in the pivot grid. This should produce the desired result.

    Please see the places you can drag and drop the the Fright measure (blue) and the Freight dimension (red) in the screenshot below:

    Let us know if you need any additional assistance.

     

    Best,

    Kiril

Reply
  • 765
    posted in reply to Kiril Matev

    Hi Kiril,
    thanks for your help.
    Yes, it is correct that I took the dimension Fright and not Freight measure.
    With the Fright measures I have no problems. It works fine.

    But I have another problem. I have in the Measures group no items.

    I use NetAdvantage 11.1 and the FlatDataSource.
    I have a DataTable with special column-caption (the signs: [, ] and space): "RX4 [mg/l]" or "TZE [g/ml]".
    So I can't use the code from the example PivotGridWinformsHosting; method loadNthwindInvoicesBtn_Click:
    var q = from data in odt
      select new
      {
      ...
      }

    I take the example from Todor Karkelanov in the forum with the DynamicTypeBuilder:
     
    http://community.infragistics.com/forums/p/46138/248989.aspx#248989
    It works fine.


            public void SetFlatDatasource(string displayName, DataTable dataTable)
            {
                DynamicTypeBuilder typeBuilder = new DynamicTypeBuilder
                {
                    DynamicAssemblyName = "Test",
                    DynamicTypeName = displayName
                };

                IList<DynamicTypePropertyInfo> properties = new List<DynamicTypePropertyInfo>();

                foreach (DataColumn column in dataTable.Columns)
                {
                    DynamicTypePropertyInfo propertyInfo = new DynamicTypePropertyInfo
                    {
                        PropertyName = column.ColumnName,
                        PropertyType = column.DataType
                    };

                    properties.Add(propertyInfo);
                }

                Type dynamicType = typeBuilder.GenerateType(properties);

                Type listType = typeof(List<>);

                Type genericListType = listType.MakeGenericType(dynamicType);

                IList list = (IList)Activator.CreateInstance(genericListType);

                foreach (DataRow dataRow in dataTable.Rows)
                {
                    object myDynamicInstance = Activator.CreateInstance(dynamicType);

                    foreach (DataColumn column in dataTable.Columns)
                    {
                        PropertyInfo propertyVal = dynamicType.GetProperty(column.ColumnName);

                        if (dataRow[column] != DBNull.Value)
                            propertyVal.SetValue(myDynamicInstance, dataRow[column], null);
                    }

                    list.Add(myDynamicInstance);
                }

                FlatDataSource flatDataSource = new FlatDataSource()
                {
                    ItemsSource = list,
                    Cube = DataSourceBase.GenerateInitialCube(displayName),
                    Columns = FlatDataSource.GenerateInitialItems("[Test_NR].[Test_NR]"),
                    Rows = FlatDataSource.GenerateInitialItems("[RECORD_NR].[RECORD_NR]"),
                    Measures = DataSourceBase.GenerateInitialItems("RX4 [mg/l].RX4 [mg/l]")
                };

                xamPivotGrid.DataSource = flatDataSource;
                xamPivotDataSelector.DataSource = flatDataSource;
            }

     

    But the values from the columns "RX4 [mg/l]" or "TZE [g/ml]" are type of string. That is correct, because
    the values in these columns are:
    2,5E-04
    <0,5E-02
    >8,63E-04

    I have read: I must have numeric values for measures. That's why I have no items in the Measures group.
    Is that correct?
    What can I do?


    Thanks.
    Alexander     

Children