locked
Retrieve Lab Value RRS feed

  • Question

  • I have succecfully added lab values to healthvault. I have also retrieved the lab name and date. What I can't seem to retrieve is the value of the lab. For instance, this code gives me lab name and date, but not the results. How do I get the results of the labs?

     

    Thanks,

     

    Greg

     

        Dim LR As List(Of LabTestResults) = GetValues(Of LabTestResults)(LabTestResults.TypeId)
    
        For Each LabItem As LabTestResults In LR
          iRowCount += 1
          Dim row As New TableRow
          c_LabTable.Rows.Add(row)
    
          Dim dateCell As New TableCell
          dateCell.Text = String.Format(DateString, LabItem.When.ToString())
          row.Cells.Add(dateCell)
    
          Dim LabCell As New TableCell
          LabCell.Text = LabItem.ToString
    
          row.Cells.Add(LabCell)
          If iRowCount = iEncCount Then
            Exit For
          End If
        Next
    

    Thursday, July 22, 2010 8:25 PM

Answers

  • Aneesh,

     

    This was very helpful, thank you. At this point I am still just exploring the HV. After I added lab data I wanted to get it back for display and I just could not seem to access all of the elements that I populated when I put the data in. This did it.

     

    Greg

    • Marked as answer by GrexP Tuesday, July 27, 2010 11:25 PM
    Tuesday, July 27, 2010 11:17 PM

All replies

  • I was able to get the GeneralMeasurement.Dispay value with "LabItem.Groups(0).Results(0).Value.ToString", but still can't access the StructuredMeasurement.Value.

     

    Greg

    Thursday, July 22, 2010 10:29 PM
  • Hello Greg,

    The GeneralMeasurement type has a field named Structured which is a collection of StructuredMeasurement. You can access it as details.Value.Measurement.Structured where details is of type LabTestResultDetails. Is this what you are trying to access?

    Thanks and Regards,

    Aneesh D.

    Friday, July 23, 2010 1:45 AM
  • I think. I see that in the object browser and the elements you list show up as I type, but I'm unsure how to use it. So far all I've been doing is using filters to get collections of items. I can get a collection of LabTestResults this way.

    Now I guess I need to get a LabTestResultsDetail, but that does not have a TypeID. I'm not sure how to take a LabTestResult from the collection and access the LabTestResultsDetails. I know how to use  LabTestResultsDetails to put data in to the HV. 

     

    Greg

    Tuesday, July 27, 2010 12:01 AM
  • Hello Greg,

    You can access the LabTestResultDetails as shown in the below sample code,

     HealthRecordItemCollection resultCollection = PersonInfo.SelectedRecord.GetItemsByType(LabTestResults.TypeId);

     foreach (LabTestResults result in resultCollection)
     {
      foreach (LabTestResultGroup resultGroup in result.Groups)
      {
       foreach (LabTestResultDetails resultDetails in resultGroup.Results)
       {
        // Write code to use the resultDetails in here
       }
      }
     }

    I couldn't properly understand what you are trying to establish here. If you can explain the scenario that you are trying to implement I can be of more help.

    Thanks and Regads,
    Aneesh D.

    • Proposed as answer by Aneesh D Tuesday, July 27, 2010 5:28 PM
    Tuesday, July 27, 2010 5:27 PM
  • Aneesh,

     

    This was very helpful, thank you. At this point I am still just exploring the HV. After I added lab data I wanted to get it back for display and I just could not seem to access all of the elements that I populated when I put the data in. This did it.

     

    Greg

    • Marked as answer by GrexP Tuesday, July 27, 2010 11:25 PM
    Tuesday, July 27, 2010 11:17 PM