Info |
---|
SummaryTemplate Attributes allow administrators to use the Razor templating language to construct dynamic text or hyperlinks. They are also often used to calculate values based on client-specific business rules which are then used as inputs to other pieces of configuration. See also: /wiki/spaces/DOCS/pages/741015842 |
Extensions
SourceAddressAttribute.GetDistanceTo(TargetAddressAttribute, DistanceUnit.Miles) - Distance between two Validated Address Attributes (with Latitude and Longitude values)
Uses System.Device.Location.GeoCoordinate to make the distance calculation
codeSample Template
Code Block |
---|
@using Heuristics.LearningBuilder.WorkflowAttributes @DistanceFrom() @functions { public string DistanceFrom() { try { var address1 = Model.MemberRole.GetAttribute<AddressAttribute>("Address_1"); var address2 = Model.MemberRole.GetAttribute<AddressAttribute>("Address_2"); if (address1 == null || address2 == null || address1.AddressId == 0 || address2.AddressId == 0) { return string.Empty; } return address1.GetDistanceTo(address2, DistanceUnit.Miles).ToString("N2") + " miles"; } catch(Exception a) { return a.Message; } } } |
Related articles
Filter by label (Content by label) | ||
---|---|---|
|
Page Properties | ||
---|---|---|
| ||
|