Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Dynamical write CompoundFind

Featured Replies

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 ?

 

 

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.