Claus Lavendt Posted February 24, 2013 Posted February 24, 2013 Hi I have an array ( $Seg6 ) which contains multiply values and could have as many as 60..... I need to use it in a compound find, where the number of values in $Seg6 decides how many find requests, that should be created in the compound find. However, I have tried with: // Create search request and criteria and add it to $compoundFind for each value in $seg6 for($x=1; $x <= count($seg6); $x++){ $findreq[$x] = $this->fmcon->newFindRequest('WEB-ART-Artikel'); $findreq[$x]->addFindCriterion('_seg_6','='. $seg6[$x]); $findreq[$x]->addFindCriterion('__kf_DEB','=='. $_SESSION['deb_id']); $findreq[$x]->addFindCriterion('_WebSubKat','='. $_GET['_WebSubKat']); $findreq[$x]->addFindCriterion('WEB','=='. 'Active'); $compoundFind->add([$x],$findreq[$x]); } But it seems that I can not use the $x as a part of a $variable name.... $seg6 = explode(chr(10), $_SESSION['Seg6']); // Create the Compound Find command object $compoundFind = $this->fmcon->newCompoundFindCommand('WEB-ART-Artikel'); if(count($seg6)>= 1){ $findreq1 = $this->fmcon->newFindRequest('WEB-ART-Artikel'); $findreq1->addFindCriterion('_seg_1','='. $_SESSION['Seg1']); $findreq1->addFindCriterion('_seg_2','='. $_SESSION['Seg2']); $findreq1->addFindCriterion('_seg_3','='. $_SESSION['Seg3']); $findreq1->addFindCriterion('_seg_4','='. $_SESSION['Seg4']); $findreq1->addFindCriterion('_seg_5','='. $_SESSION['Seg5']); $findreq1->addFindCriterion('_seg_6','='. $seg6[0]); $findreq1->addFindCriterion('__kf_DEB','=='. $_SESSION['deb_id']); $findreq1->addFindCriterion('_WebSubKat','='. $_GET['_WebSubKat']); $findreq1->addFindCriterion('WEB','=='. 'Active'); $compoundFind->add(1,$findreq1); } if(count($seg6)>= 2){ $findreq2 = $this->fmcon->newFindRequest('WEB-ART-Artikel'); $findreq2->addFindCriterion('_seg_1','='. $_SESSION['Seg1']); $findreq2->addFindCriterion('_seg_2','='. $_SESSION['Seg2']); $findreq2->addFindCriterion('_seg_3','='. $_SESSION['Seg3']); $findreq2->addFindCriterion('_seg_4','='. $_SESSION['Seg4']); $findreq2->addFindCriterion('_seg_5','='. $_SESSION['Seg5']); $findreq2->addFindCriterion('_seg_6','='. $seg6[1]); $findreq2->addFindCriterion('__kf_DEB','=='. $_SESSION['deb_id']); $findreq2->addFindCriterion('_WebSubKat','='. $_GET['_WebSubKat']); $findreq2->addFindCriterion('WEB','=='. 'Active'); $compoundFind->add(2,$findreq2); } if(count($seg6)>= 3){ $findreq3 = $this->fmcon->newFindRequest('WEB-ART-Artikel'); $findreq3->addFindCriterion('_seg_1','='. $_SESSION['Seg1']); $findreq3->addFindCriterion('_seg_2','='. $_SESSION['Seg2']); $findreq3->addFindCriterion('_seg_3','='. $_SESSION['Seg3']); $findreq3->addFindCriterion('_seg_4','='. $_SESSION['Seg4']); $findreq3->addFindCriterion('_seg_5','='. $_SESSION['Seg5']); $findreq3->addFindCriterion('_seg_6','='. $seg6[2]); $findreq3->addFindCriterion('__kf_DEB','=='. $_SESSION['deb_id']); $findreq3->addFindCriterion('_WebSubKat','='. $_GET['_WebSubKat']); $findreq3->addFindCriterion('WEB','=='. 'Active'); $compoundFind->add(3,$findreq3); } //Set sort order $compoundFind->addSortRule('ArtikelnrSE', 1, FILEMAKER_SORT_ASCEND); //Execute compound find command $result = $compoundFind->execute(); The below code is hardcoded and very manual, however it works.... But, does anyone have a way of creating the above code dynamically ?
Recommended Posts
This topic is 4545 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now