Container.GetType
-----------------

Returns the type at the given index (zero based).

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

MBS( "Container.GetType"; Container; Index ) 

**MBS**( **"Container.GetType";** /\* Returns the type at the given index (zero based). \*/  
**$Container**; /\* The container field or value to inspect. \*/   
**$Index**) /\* The index of the the item to query in the container.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Container | The container field or value to inspect. | $container |
| Index | The index of the the item to query in the container. | 0 |

### Description

Returns the type at the given index (zero based).  
A container contains several data parts, each with an unique type.  
Types are 4 character long and some types like "PDF " have an extra space.  
  
See [Container.GetTypes](ContainerGetTypes.md) to query list of all 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](ContainerGetCount.md)"; $container )\]  
Set Variable \[$index ; Value:0\]  
Loop  
 #query the type of stream with given index  
 Set Variable \[$type ; Value:MBS ( "Container.GetType"; $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.GetBase64](ContainerGetBase64.md)
- [Container.GetCount](ContainerGetCount.md)
- [Container.GetHex](ContainerGetHex.md)
- [Container.GetMimeType](ContainerGetMimeType.md)
- [Container.GetText](ContainerGetText.md)
- [Container.GetTypes](ContainerGetTypes.md)
- [Container.GetWidth](ContainerGetWidth.md)
- [Container.RenameStream](ContainerRenameStream.md)
- [Folders.UserDesktop](FoldersUserDesktop.md)
- [PDFKit.GeneratePreview](PDFKitGeneratePreview.md)

### Blog Entries

- [MBS Filemaker Plugin 2.1 prerelease 2](https://www.mbsplugins.de/archive/2010-05-11/MBS_Filemaker_Plugin_21_prerel/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

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

  
[Container.GetTotalSize](ContainerGetTotalSize.md) - [Container.GetTypeSize](ContainerGetTypeSize.md)

[HTML Version](ContainerGetType.shtml)