"createMultipageTIFFDatastore" can't SplitPositions into separate files

Hi,

I am trying to use “createMultipageTIFFDatastore” in beanshell to acquire multidimensional data, with multiple positions.

When I set the option “shouldSplitPositions” to “false”, the acquisition works fine with all the data saved correctly within one folder.

However, if I set the option “shouldSplitPositions” to “true”, the data are not split into multiple folders. Moreover, it seems that only the data for the last position is saved.

Note: using multiple positions in MDA works fine.
MM version: 2.0 Gamma Nightly 20201018

What could I be doing wrong?

Sample code:

//acquisition parameter
pathRoot = "D:/data/20201019_multipos_test";
pathPrefix = "test";
int nrFrames = 2;
int nrChannels = 2;
int numPos = 2;
int nrSlices = 10;
savePath = pathRoot + "/" + pathPrefix;
savePath = mm.data().getUniqueSaveDirectory(savePath);
// store data
store = mm.data().createMultipageTIFFDatastore(savePath, true, false);
mm.displays().createDisplay(store);
builder = mm.data().getCoordsBuilder().z(0).channel(0).stagePosition(0);
for (int f=0; f<nrFrames; f++){
	for (int p=0; p<numPos; p++){
		for(int ch=0; ch<nrChannels; ch++){	
			mmc.startSequenceAcquisition(nrSlices, 0, true);
			slice=0;
			while (mmc.getRemainingImageCount() > 0 || mmc.isSequenceRunning(mmc.getCameraDevice())) {
			   if (mmc.getRemainingImageCount() > 0) {
			  
			      tagged = mmc.popNextTaggedImage();
			      image = mm.data().convertTaggedImage(tagged,builder.time(f).stagePosition(p).channel(ch).z(slice).build(), null);
			      store.putImage(image);
				   slice++;
			   }
			   else {
			      // Wait for another image to arrive.
			      mmc.sleep(20);
			   }
			}	
			mmc.stopSequenceAcquisition();
		}
	}
}

Thank you,
Bin