Container.GetCount
------------------

Counts the number of types in a container field.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Container](component_Container.md) | [1.4](newinversion14.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Container.GetCount"; Container ) 

**MBS**( **"Container.GetCount";** /\* Counts the number of types in a container field. \*/  
**$Container**) /\* The container field or variable containing container value. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Container | The container field or variable containing container value. |  |

### Description

Counts the number of types in a container field.  
A container contains several data parts, each with an unique type.  
This returns the number of types in a container.  
### Examples

Export all streams in container to individual files:

 Set Variable \[$container ; Value:Test::Image \]  
\#where to save   
Set Variable \[$DesktopFolder ; Value:MBS ("[Folders.UserDesktop](FoldersUserDesktop.md)")\]  
\#loop over streams in container   
Set Variable \[$count ; Value:MBS ( "Container.GetCount"; $container )\]  
Set Variable \[$index ; Value:0\]  
Loop  
 #query the type of stream with given index  
 Set Variable \[$type ; Value:MBS ( "[Container.GetType](ContainerGetType.md)"; $container ; $index )\]  
 #write it to a file  
 Set Variable \[$path ; Value:$DesktopFolder &amp; "/" &amp; $type \]  
 Set Variable \[$r ; Value:MBS ( "[Container.Export](ContainerExport.md)"; $container ; $index ; $path )\]  
 #next  
 Set Variable \[$index ; Value:$index + 1\]  
 Exit Loop If \[$count = $index \]  
End Loop  
### See also

- [Container.Export](ContainerExport.md)
- [Container.GetBase64](ContainerGetBase64.md)
- [Container.GetHeight](ContainerGetHeight.md)
- [Container.GetHex](ContainerGetHex.md)
- [Container.GetName](ContainerGetName.md)
- [Container.GetSize](ContainerGetSize.md)
- [Container.GetText](ContainerGetText.md)
- [Container.GetType](ContainerGetType.md)
- [Container.GetTypes](ContainerGetTypes.md)
- [Container.GetWidth](ContainerGetWidth.md)

### Example Databases

- [Drag and Drop/DragTest Popover](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Drag%20and%20Drop/DragTest%20Popover.shtml#5ScriptAnchor_)
- [Drag and Drop/DragTest](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Drag%20and%20Drop/DragTest.shtml#5ScriptAnchor_)
- [Mac and iOS/PDFKit/PDF Merge Shrink Tool](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/PDF%20Merge%20Shrink%20Tool.shtml#5ScriptAnchor_)

This function checks for a license.

Created 18th August 2014 , last changed 6th November 2018

  
[Container.GetBase64](ContainerGetBase64.md) - [Container.GetDataURL](ContainerGetDataURL.md)

[HTML Version](ContainerGetCount.shtml)