TechNet
Export (0) Print
Expand All

AliasedValue Class

 

Used to return aggregate, group by, and aliased values from a query.

Namespace:   Microsoft.Xrm.Sdk
Assembly:  Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

System.Object
  Microsoft.Xrm.Sdk.AliasedValue

[DataContractAttribute(Name = "AliasedValue", Namespace = "http://schemas.microsoft.com/xrm/2011/Contracts")]
[KnownTypeAttribute("GetKnownAliasedValueTypes")]
public sealed class AliasedValue : IExtensibleDataObject

NameDescription
System_CAPS_pubmethodAliasedValue()

Initializes a new instance of the AliasedValue class.

System_CAPS_pubmethodAliasedValue(String, String, Object)

Initializes a new instance of the AliasedValue class.

NameDescription
System_CAPS_pubpropertyAttributeLogicalName

Gets the name of the attribute on which the aggregate, group by, or select operation was performed.

System_CAPS_pubpropertyEntityLogicalName

Gets the name of the entity the attribute belongs to.

System_CAPS_pubpropertyExtensionData

Gets or sets the structure that contains extra data.

System_CAPS_pubpropertyValue

Gets the value returned by the query.

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

// Fetch the average of estimatedvalue for all opportunities.  This is the equivalent of 
                    // SELECT AVG(estimatedvalue) AS estimatedvalue_avg ... in SQL.
                    System.Console.WriteLine("===============================");
                    string estimatedvalue_avg = @" 
                    <fetch distinct='false' mapping='logical' aggregate='true'> 
                        <entity name='opportunity'> 
                           <attribute name='estimatedvalue' alias='estimatedvalue_avg' aggregate='avg' /> 
                        </entity> 
                    </fetch>";

                    EntityCollection estimatedvalue_avg_result = _serviceProxy.RetrieveMultiple(new FetchExpression(estimatedvalue_avg));

                    foreach (var c in estimatedvalue_avg_result.Entities)
                    {
                        decimal aggregate1 = ((Money)((AliasedValue)c["estimatedvalue_avg"]).Value).Value;
                        System.Console.WriteLine("Average estimated value: " + aggregate1);

                    }

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top

Microsoft Dynamics CRM 2016 and CRM Online

© 2016 Microsoft. All rights reserved. Copyright

Community Additions

Show:
© 2016 Microsoft