Archive.Close
-------------

Closes the current archive.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Archive](component_Archive.md) | [13.1](newinversion131.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Archive.Close" { ; FileName } ) 

**MBS**( **"Archive.Close";** /\* Closes the current archive. \*/  
**$FileName**) /\* Optional; The filename for the zip to use.  
Only for when we return a container.e.g. "test.zip" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| FileName | The filename for the zip to use.   Only for when we return a container. | "test.zip" | Optional |

### Result

Returns OK, container value or error.

### Description

Closes the current archive.  
For file based archives, the file is closed and OK returned.  
For container based archives, we return the final container value.  
### Examples

Create a zip as container value and store it:

 Set Variable \[ $r ; Value: MBS ( "[Archive.Create](ArchiveCreate.md)"; "zip"; "deflate") \]   
If \[ MBS ("IsError") \]   
 Show Custom Dialog \[ "Failed to create zip archive." ; $r \]   
 Exit Script \[ Text Result: \]   
End If  
\#   
Go to Record/Request/Page \[ First \]  
Set Variable \[ $destPage ; Value: 1 \]   
Loop  
 Set Variable \[ $r ; Value: MBS ( "[Archive.AddContainer](ArchiveAddContainer.md)"; Merge PDFs::InputPDF ) \]   
 Go to Record/Request/Page \[ Next ; Exit after last: On \]  
End Loop  
Set Variable \[ $zip ; Value: MBS ( "Archive.Close"; "test.zip") \]   
If \[ MBS ("IsError") \]   
 Show Custom Dialog \[ "Failed to create zip archive." ; $r \]   
Else  
 Set Field \[ Merge PDFs::FinalPDF ; $zip \]   
End If  
### See also

- [Archive.AddContainer](ArchiveAddContainer.md)
- [Archive.AddFile](ArchiveAddFile.md)
- [Archive.AddText](ArchiveAddText.md)
- [Archive.Create](ArchiveCreate.md)
- [Archive.IsOpen](ArchiveIsOpen.md)
- [IsError](IsError.md)

### Release notes

- **Version 13.1**
    - Added [Archive.Create](https://www.mbsplugins.eu/ArchiveCreate.shtml), [Archive.AddContainer](https://www.mbsplugins.eu/ArchiveAddContainer.shtml), [Archive.AddFile](https://www.mbsplugins.eu/ArchiveAddFile.shtml), [Archive.AddText](https://www.mbsplugins.eu/ArchiveAddText.shtml) and [Archive.Close](https://www.mbsplugins.eu/ArchiveClose.shtml) functions.

### Example Databases

- [Archives/Archives](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Archives/Archives.shtml#2ScriptAnchor_)
- [DynaPDF/Merge PDFs](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Merge%20PDFs.shtml#10ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 12 - Sending Mails](https://www.mbsplugins.de/archive/2024-12-12/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 9 - Archives](https://www.mbsplugins.de/archive/2024-12-09/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [Compress and Send](https://www.mbsplugins.de/archive/2024-07-06/Compress_and_Send/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 13.1](https://www.mbsplugins.de/archive/2023-03-15/New_in_MBS_FileMaker_Plugin_13/monkeybreadsoftware_blog_filemaker)
- [Build archives on the fly](https://www.mbsplugins.de/archive/2023-02-27/Build_archives_on_the_fly/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.1pr4](https://www.mbsplugins.de/archive/2023-02-24/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.1pr3](https://www.mbsplugins.de/archive/2023-02-16/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 4/2023, Seite 38](https://filemaker-magazin.de/neuigkeit/4233-Appetithappen-FMM_202304)

This function checks for a license.

Created 13th February 2023 , last changed 17th February 2023

  
[Archive.BZip2Version](ArchiveBZip2Version.md) - [Archive.Compress](ArchiveCompress.md)

[HTML Version](ArchiveClose.shtml)