+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Computed Columns using nolics class

Computed Columns using nolics class

2 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    06 Oct 2010
    Link to this post
    Hi team,

    I have some problems to use a computed column in nolics a class. Basically i have stored a string of latitude and longitude comma separed as lat;lng in a string(varchar). and i need to use as Latitude and Longitude in others procedures. Could you help me to create this table using a nolics class. It's similar to store a calculated value but need to preserve in table for use.

    actual
    string geolatlng[lenght 100];

    future
    string geolatlng[lenght 100];
    float geolatitude <--calculated columns from split geolatlng left vale
    float geolongitude <---calculated from column using right value

    Cheers
    Thanks.
  2. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    08 Oct 2010
    Link to this post
    nobody?
     create table Demo (
     
        LatLng varchar(100),
        Lat as CAST(LEFT(LatLng, charindex(';',LatLng)-1) as float) PERSISTED,
        Lng as CAST(SUBSTRING(LatLng, charindex(';',LatLng)+1, LEN(LatLng)-charindex(';',LatLng)) as float) PERSISTED
    )
     
    Create Persisted Data based from one existing fields
     
    dbclass Demo{
       primary key long ID;
       string LatLng[Lenght=100]; //is -1.3452;34.8979
       double Latitude ??;    // using LatLng -10.3452
       double Longitude ??;    // using LatLng 34.8979
    }
2 posts, 0 answered