Hi Armin and List,

resently mentioned me, that on to many join is nit working.
I have added few lines to printFields function and it seems to work.
There was a problem with the json string.
I use 4.0 version.

My patch

     function printFields($qShape)
     {

         // PRINT RESULT ROW
         $loop = 2;     // Used for one-to-many joins to break while loop when 
all DB data printed
         $dbloop = 0;   // Used for one-to-many joins as index to step through 
join table

// ************************* Lines added ***************************
// save start of qstring SIKI
$shplink = $this->qStr;
// ************************* End lines added ***********************
         while($loop > 0) {

             ##$this->qStr .= "pippo anzahl felder:" . sizeof($this->selFields);
             // Add shape index to array, used for highlight
             //$resultindexes[] = $qShpIdx;
// ************************* Lines added ***************************
if ($dbloop) {
        $this->qStr .= "],";
        $this->qStr .= $shplink;
}
// ************************* End lines added ***********************

             // Print all OTHER COLUMNS from SHAPE
             for ($iField=0; $iField < sizeof($this->selFields); $iField++) {
                 $fldName  = $this->selFields[$iField];
                 $fldValue = $qShape->values[$fldName];
                 //$this->qStr .= $fldValue;

                 $this->qStr .= $this->printFieldValues($fldName, $fldValue);
             }

             // Now add JOIN COLUMNS from DB if defined
             if ($this->joinList && $this->dbh) {
                 $toValue = $qShape->values[$this->toField];
                 $joinFieldList = split(',', $this->joinFields);
                 // get data only once from DB
                 if ($dbloop == 0) {
                     $data = $this->returnData($this->dbh, $this->sql, 
$toValue, $this->fromFieldType, $this->one2many);
                     $dbresCount = count($data);
                 }

                 if ($dbresCount > 0) {
                     $jfldi = 0;
                     foreach($data[$dbloop] as $val) {
                         $fldName =  trim($joinFieldList[$jfldi]);
                         $jfldi++;
                         $this->qStr .= $this->printFieldValues($fldName, $val);
                     }
                     $dbloop++;

                     // if NO one2many set $dbloop to end value and stop after 
first record
                     if (!$this->one2many) {
                         $dbloop = $dbresCount;
                     }

                     // if all recors from one2many retrieved (or only one2one) 
stop loop
                     if ($dbloop == $dbresCount) $loop = 0;
                 } else {
                     $loop = 0;
                 }

             // NO JOIN field defined, so break while loop and continue with 
next record
             } else {
                 $loop = 0;
             }

         }

     }


I have found some information missing in the documentation about the XY 
layers. It is not stated, that an id field must be given beside x and y 
columns, e.g.
"XYLAYER_PROPERTIES" "mssql://:@localhost/db||table||x,y,id"
                                                          ==!
regards,
Zoltan

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
pmapper-users mailing list
pmapper-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pmapper-users

Reply via email to