Unanswered Blood Pressure Data Retrieving from HV

  • Wednesday, June 13, 2012 1:13 AM
     
     

    Hello Friends, 

    I need an advice from you. My goal is also to retrieve the BP data from the HealthVault.

    I'm modifying the clientsample sample code "HVClientSample"  given along with the SDK. [A weight data extraction example is given there]

    But I'm stuck in the following code,

    foreach (HealthRecordItem item in items) // 
                    {
                        ItemTypes.BloodPressure bp = (ItemTypes.BloodPressure)item; 
                        ListViewItem lvi = new ListViewItem(bp.Diastolic.ToString()); 
                        lvi.SubItems.Add(bp.When.ToString());  

                        listViewBP.Items.Add(lvi);

    }

    As per my code, in "items", I have the matching BP items. But still the above code isnt working?

    Is there an error in the above lines of code? Please help. Else can you direct me to a working example/sample code of a Blood Pressure extraction from HV?

    Thanks,

    KP


    Karthik Puvvada

All Replies

  • Friday, June 15, 2012 8:13 AM
     
      Has Code


    This is the generic method, just supply the typeID (http://developer.healthvault.com/types/types.aspx) so you would use : -

    BloodPressure.TypeId
    

        public List<T> GetValues<T>(Guid typeID) where T : HealthRecordItem
        {
            HealthRecordSearcher searcher = PersonInfo.SelectedRecord.CreateSearcher();
     
            HealthRecordFilter filter = new HealthRecordFilter(typeID);
            searcher.Filters.Add(filter);
     
            HealthRecordItemCollection items = searcher.GetMatchingItems()[0];
     
            List<T> typedList = new List<T>();
     
            foreach (HealthRecordItem item in items)
            {
                typedList.Add((T)item);
            }
     
            return typedList;
        }

    Milo