JSON.Import.SetExtraField
-------------------------

Sets the extra field to add to all tables.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [JSON](component_JSON.md) | [14.2](newinversion142.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "JSON.Import.SetExtraField"; FieldName; FieldValue { ; FieldType } ) 

**MBS**( **"JSON.Import.SetExtraField";** /\* Sets the extra field to add to all tables. \*/  
**$FieldName**; /\* The name of the extra field.e.g. "ImportID" \*/   
**$FieldValue**; /\* The value for this field.  
Can be any data type, but must match field type.e.g. 1 \*/   
**$FieldType**) /\* Optional; The SQL field type.  
Default is "VARCHAR" for a text field.e.g. "VARCHAR" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| FieldName | The name of the extra field. | "ImportID" |  |
| FieldValue | The value for this field.   Can be any data type, but must match field type. | 1 |  |
| FieldType | The SQL field type.   Default is "VARCHAR" for a text field. | "VARCHAR" | Optional |

### Result

Returns OK or error.

### Description

Sets the extra field to add to all tables.  
Please call before [JSON.Import](JSONImport.md).  
You can call it again when import loop is done and pass in empty name and value to clear it.  
Only one extra field and only added when table is created.  
### Examples

Set extra field:

 Set Variable \[ $r ; Value: MBS ( "JSON.Import.SetExtraField"; "test"; "Hello"; "VARCHAR") \]  
### See also

- [JSON.Import](JSONImport.md)
- [JSON.Import.SetBaseFields](JSONImportSetBaseFields.md)
- [XML.Import.SetExtraField](XMLImportSetExtraField.md)

### Release notes

- **Version 14.2**
    - Added [JSON.Import.SetExtraField](https://www.mbsplugins.eu/JSONImportSetExtraField.shtml) and [JSON.Import.SetBaseFields](https://www.mbsplugins.eu/JSONImportSetBaseFields.shtml) functions.

This function is free to use.

Created 10th May 2024 , last changed 11st May 2024

  
[JSON.Import.SetBaseFields](JSONImportSetBaseFields.md) - [JSON.Import.Status](JSONImportStatus.md)

[HTML Version](JSONImportSetExtraField.shtml)