Setting field captions/Obtaining field data

Posted by: kbiebel on 3 August 2017, 3:50 pm EST

  • Posted 3 August 2017, 3:50 pm EST

    I'd like to iterate through a Dimension's fields and set the caption of the field after the data has been loaded. (PV is bound to an XML data source). DynamiCube had an API where you could set the field caption to something other than the VarName so that the field would display the caption but be ordered/sorted by the VarName. For example, month numbers would be the VarName, and the caption set to the month name. Is there a way to do this in Analysis? If so, can you provide an exampe?



    Also, I asked about obtaining the selected data through tuples. Is there any progress on that?



    Thank you.
  • Replied 3 August 2017, 3:50 pm EST

    kbiebel,

    Please take some time and respond to this thread:
       http://www.datadynamics.com/forums/115371/ShowPost.aspx

    Your feedback would be very valuable to us.

    As for setting the Field and Member captions, you can do all of this in the Schema. Member captions are managed in schema by using the \\Item\CaptionExpression node.

    You can find an example of this by viewing any of the schema files that ship with the setup. The best example would probably be here:
       \Data Dynamics\Analysis\DataSources\NWind\NwindMDB-SalesProductsSuppliers.schema

    Hope this helps,
    Luc
  • Replied 3 August 2017, 3:50 pm EST

    Maybe I'm missing something here. Your schema file sets captions for Dimensions that are predefined before the data is fetched. The actual field values are not in a schema but are present when loaded in the cube. I want to set the caption for a month field value of 1 as Jan, 2 as Feb, 3 as Mar, a quarter field value of 1 as Qtr1, etc.



    In DynamiCude, there was a way to iterate through the fields and set captions. Can this be done in Analysis?

  • Replied 3 August 2017, 3:50 pm EST

    The examples in the prev post may not be the best because the number value can be used in the caption. However, if I have a 1 value in a field, I would like to set the caption to something in a lookup table. For example, 1 = Medicare, 2=Medicaid, 3=Blue Cross, etc.
  • Replied 3 August 2017, 3:50 pm EST

    kbiebel,
    First of all please note that ddAnalysis is not a new version of DynamiCube but a completely new and different product and as such we are not recreating DynamiCube with ddAnalysis.  The \\Item\Caption node is used to define the caption of the field that would be displayed in the schema and on the shelves.  The \\Item\CaptionExpression node can be used to set a caption for each member to include additional text (which could include member captions from other fields) or specify a different field from the data source that is related to the item's key field (i.e. the field referenced in the \\Item\Expression node).  The caption expression will retrieve captions as the data is loaded.  If your lookup table will be located in your database you can include it within your query.  For example say you have a field, HealthCareID, for the code and another, HealthCareName, for the name of the company.  Assuming that you are automatically generating an initial schema using the command line utility provided, you could modify the schema file changing the value of the \\Item\CaptionExpression node (that corresponds to the HealthCareID) from "=Fields!HealthCareID.Value" to "=Fields!HealthCareName.Value".  Once this is done the field's XML should look similar to the following:


        HealthCareID
        Attribute
        HealthCare
        =Fields!HealthCareID.Value
        =Fields!HealthCareName.Value


    Also if the HealthCareID is included in the measures, you would need to move it to an attributes dimension within the schema file. You can also change its name by changing the value in the \\Item\name node.  

    If you are automatically generating the schema from the API, you would also need to perform a similar procedure.  Assuming that the ID field is initially setup as a measure, you could "move" it to the attributes dimension, change the caption expression, and modify its name by using code similar to the following code snippet:

                DataDynamics.Analysis.Schema.MeasuresDimBuilder myMeasureDimenBuilder = (DataDynamics.Analysis.Schema.MeasuresDimBuilder)sb.Dimensions["Measures"];
                DataDynamics.Analysis.Schema.AttributesDimBuilder myAttributeDimenBuilder = (DataDynamics.Analysis.Schema.AttributesDimBuilder)sb.Dimensions["Attributes"];

                DataDynamics.Analysis.Schema.AttributeBuilder myAtrtibuteBuilder = new DataDynamics.Analysis.Schema.AttributeBuilder("HealthCareProvider");
                myAtrtibuteBuilder.SetExpression("=Fields!HealthCareID.Value");
                myAtrtibuteBuilder.SetCaptionExpression("=Fields!HealthCareName.Value");
                myAttributeDimenBuilder.AddField(myAtrtibuteBuilder).SetDefaultField(myAtrtibuteBuilder);

                //remove the unneeded fields from the schema
                myMeasureDimenBuilder.RemoveField(myMeasureDimenBuilder.Fields["HealthCareID"]);
                myAttributeDimenBuilder.RemoveField(myAttributeDimenBuilder.Fields["HealthCareName"]);

    If you have any further questions please feel free to let me know.
Need extra support?

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

Learn More

Forum Channels