Hi, I have wrote code to access a database and a plot points on a graph to 
represent the database values, but there is a problem occuring which i cannot 
figure out. I am using a for loop to search the databasae values but my code 
seems to just print out the last value in the database for each record 
contained in the database.

For example there are 3 entrys in the datase say:
90 at index 0; 
50 at index 1;
40 at index 2;

instead of plotting the points (x, 90), (x,50) and (x,40);
it just plots (x,40) 3 times.

The problem seems to be with the for loop? This probably is a coding issue and 
might not be appropiate to post but i am desperate to solve this problem. Here 
is the associated code.

//code to search to data base
  WinPushDrawState();

  Xvalue = 15;
  for(index = 0; index < nbRec;)
   {
     
      RecH = (MemHandle)DmQueryRecord(db,index);
      RecP = (HypertensionRecordTypePtr)MemHandleLock(RecH);
      
      Yvalue = HypertensionRecord.DBPulseValue;
       
      MemHandleUnlock(RecH);
      
//This is just code to calculate the proper position to plot the point
      Yvalue = Yvalue/10;
      Yvalue = YaxisIncrement * Yvalue;
      Yvalue = 135 - Yvalue;
  

   
     PlotPoint(Xvalue,Yvalue);
     Xvalue+=5;
     index++;
  
  
  }

  WinPopDrawState();


//Function to plot the point
 static void PlotPoint(double XaxixPoint,double YaxisPoint)
 {
   RectangleType rect;
   UInt16 cornerDiam = 0;
   
   
   
   
   rect.topLeft.x = XaxixPoint;
   rect.topLeft.y = YaxisPoint;
   rect.extent.x = 2;
   rect.extent.y = 2;
   
   WinDrawRectangle(&rect,cornerDiam);
   
   
 }

Rob :-(
-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to