Is possible to merge row fields?

Posted by: emoscosocam-dd on 3 August 2017, 3:49 pm EST

  • Posted 3 August 2017, 3:49 pm EST

    Hello



    Suppose that a data table has the fields for a customer: "ID" and "Name". Now suppose that for a pivot table, one wants to put as a row field a "Customer" field, which has as a "child" fields "ID" and "Name", somehow merged under the "customer" field.



    Would that be possible?



    Thanks a lot.



    Thanks a lot.
  • Replied 3 August 2017, 3:49 pm EST

    EMoscosoCam,
    Thank you for your question.  Yes this is possible but requires making modifications to the schema.  What you will need to do to achieve this is add a query field to your schema (using the SchemaBuilder) that will concatenate the two fields together using the expression "=Fields!ID.Value+Fields!Name.Value".  The following C# code snippet demonstrates how to do this:
                DataDynamics.Analysis.Core.Schema.SchemaBuilder.QueryField qField = new DataDynamics.Analysis.Core.Schema.SchemaBuilder.QueryField("Customer");
                qField.SetExpression("=Fields!ID.Value+Fields!Name.Value"");
                sb.AddQueryField(qField);

    You would then need to create an attribute field that references this query field, the following code snippet demonstrates:
                DataDynamics.Analysis.Core.Schema.SchemaBuilder.AttributeField myField = new DataDynamics.Analysis.Core.Schema.SchemaBuilder.AttributeField("Customer");
                myField.SetKeyExpression("=Fields!Customer.Value"); //the expression here references the Customer query field

    Next you would add this new attribute field to the appropriate attribute dimension in your schema.  One thing I would like to point out is that this will need to be done when generating the schema either manually or after calling the AutoGenerate method (in which case the changes will need to be applied to the SchemaBuilder instance returned by the AutoGenerate method).

    Please let me know if I can be of further assistance.
Need extra support?

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

Learn More

Forum Channels