Hi,

Thanks for the help. I am able to grab the Result description text
using your method, but how can I grab this and the Date together?

$tests = $entry->getCcr()->getResults();
       foreach ($tests as $test) {
          $xpath = new DOMXpath($test->ownerDocument);
  $resultName = $xpath->query("//ccr:Results/ccr:Result/ccr:Test/
ccr:Description/ccr:Text");
//$resultDate = $xpath->query("//ccr:Results/ccr:Result/ccr:DateTime/
ccr:ExactDateTime");
 foreach ($resultName as $name => $date) {
    echo "Test result: " . $name->nodeValue . "<br>";
  }
  }


I need to be able to implement something like:
    echo "Test result: " . $name->nodeValue . " , Date: " . $date-
>nodeValue . "<br>";

How can I accomplish this? (Two separate "foreach" clauses cannot
bring the two data sets, Date and Name, together in the same spot.)

Thanks.


On Jan 6, 2:05 pm, "Eric (Google)" <[email protected]> wrote:
> Hi Josh,
>
> You should not rely on the position of elements in the CCR data.
>
> Instead, I would use xpath to extract the elements you're looking for:
> foreach ($tests as $test) {
>   $xpath = new DOMXpath($test->ownerDocument);
>   $resultName = $xpath->query("//ccr:Results/ccr:Result/ccr:Test/
> ccr:Description/ccr:Text");
>   foreach ($resultName as $name) {
>     echo "Test result: " . $name->nodeValue . "<br>";
>   }
>
> }
>
> On Jan 5, 5:54 pm, Josh <[email protected]> wrote:
>
>
>
> > I am working on grabbing information from Google for use on my site,
> > and I have a question about getting Test Results.
>
> > For procedures and immunizations, I have been able to get the
> > information using code similar to that seen below, except for the
> > change in the first line's "getTest()" to the appropriate category,
> > and the change in the third line's "Text" to Procedure and ProductName
> > respectively.
>
> > The difference that concerns me is the "item" number on line 3. For
> > procedures and immunizations, "item(0)" worked fine. For Test Results,
> > I have to use "item(1)". Is this stable code? Is the order of the
> > Google CCR static, and will the item number remain consistent for
> > grabbing the desired data? If yes, then I'll leave it as is. But if
> > not, what is the better way to accomplish this?
>
> > code fragment:
> >        $tests = $entry->getCcr()->getTest();
> >        foreach ($tests as $test) {
> >           $edesc = $test->getElementsByTagName("Text")->item(1)->nodeValue;
>
> >           $edate = $test->getElementsByTagName("ExactDateTime")->item
> > (0)->nodeValue;
> >           echo $edesc.' on '.$edate;
> >          .........etc.........
>
> > Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Health Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/googlehealthdevelopers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to