addressalign-toparrow-leftarrow-leftarrow-right-10x10arrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblightning-boltlinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstar-shapestartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Duplicates in creating a select box, need highest valued items only

From: Jd D.
Sent on: Friday, November 9, 2012, 1:37 PM
Hey guys and gals, I'm having a bit of an issue with duplication here,
I believe I can clip dupes at any point as long as my return value for the dupe remains the the largest int value. Thanks ahead of time

Here's a code stamp:
        $unitList = Base_Client_Boss::getBusinessUnitList(false, $selectedMarket, false, true);
        $marketListBox = $marketOptions = '';
        $marketList = array();

            for ($x = 1; $x <= $unitList['NUMBER_OF_BUSINESS_UNITS']; $x++) {
                $unitStr = 'BUSINESS_UNIT_' . $x . '_';

                // clip the one we don't want
                if ($unitList[$unitStr . 'ID'] && $x != 42) {

                    $businessUnit = Base_Client_Boss::getBusinessUnit($unitList[$unitStr . 'ID']);
                    if ($unitList[$unitStr . 'ID'] && $unitList[$unitStr . 'ID'] != 42) {
                        $i++;

                        $marketListBox = "<option value='" . $unitList[$unitStr . 'ID'] . "'";
                        if($selectedMarket == $unitList[$unitStr . 'ID']) {
                            $marketListBox .= ' selected';
                            $selectedMarket = 0;
                        }
   
                        $marketListBox .= ">&nbsp;&nbsp;&nbsp;" . preg_replace('/-Wimax/i', '', $unitList[$unitStr . 'NAME']) . "</option>\n";
                        $marketList[$businessUnit->getElement('STATE')][] = $marketListBox;
                    }
                }
        }

        ksort($marketList);
        foreach($marketList as $key => $val) {
            $marketOptions .= "<option disabled='disabled'>&nbsp;</option><option disabled='disabled'>{$key}&#172;</option>\n" . implode($val);
        }

        $this->view->marketOptions = $marketOptions;
    }



Here's a sample return:
<option disabled="disabled">&nbsp;</option><option disabled="disabled">WA¬</option>
<option value="56">&nbsp;&nbsp;&nbsp;Aberdeen</option>
<option value="82">&nbsp;&nbsp;&nbsp;Bellingham</option>
<option value="106">&nbsp;&nbsp;&nbsp;Everett</option>
<option value="109">&nbsp;&nbsp;&nbsp;Kitsap County</option>
<option value="102">&nbsp;&nbsp;&nbsp;Seattle</option>
<option value="105">&nbsp;&nbsp;&nbsp;Tacoma</option>
<option value="20">&nbsp;&nbsp;&nbsp;Tri-Cities</option>
<option value="173">&nbsp;&nbsp;&nbsp;Tri-Cities</option>
<option value="64">&nbsp;&nbsp;&nbsp;Wenatchee</option>
<option value="65">&nbsp;&nbsp;&nbsp;Yakima</option>
<option value="162">&nbsp;&nbsp;&nbsp;Yakima</option>


Here is the EXPECTED output:

<option disabled="disabled">&nbsp;</option><option disabled="disabled">WA¬</option>
<option value="56">&nbsp;&nbsp;&nbsp;Aberdeen</option>
<option value="82">&nbsp;&nbsp;&nbsp;Bellingham</option>
<option value="106">&nbsp;&nbsp;&nbsp;Everett</option>
<option value="109">&nbsp;&nbsp;&nbsp;Kitsap County</option>
<option value="102">&nbsp;&nbsp;&nbsp;Seattle</option>
<option value="105">&nbsp;&nbsp;&nbsp;Tacoma</option>
<option value="173">&nbsp;&nbsp;&nbsp;Tri-Cities</option>
<option value="64">&nbsp;&nbsp;&nbsp;Wenatchee</option>
<option value="162">&nbsp;&nbsp;&nbsp;Yakima</option>


--
Jd Daniel
Sr. Zend Developer
7901 Delridge Way SW #36D, Seattle

C.   [masked]


People in this
group are also in: