# \_export

Exports Asset Maintenance data as a single attached CSV file, can use parameters to filter which Maintenances will be exported.

### Parameters

#### search

Only Maintenances which include the value of this parameter will be valid

#### daysFrom

An integer value for how many days back Maintenances will be considered valid

#### daysTo

An integer filter which only allows Maintenances that will occur in the next few days ahead.

#### active

An integer value which decides if Active or Inactive Maintenances will be exported:\
0 => Only Inactive Maintenances are exported\
1 => Only Active Maintenances are exported

### Example

```
FM_api('AssetMaintenance_export',[
  'search'=>'Finance',
  'daysFrom'=>'-28',
  'daysTo'=>'0',
  'active'=>'0'
]);
```

This would export any Inactive Maintenances between now and 4 weeks ago, which include the term "Finance"

### Results

These results are from downloaded CSV files

#### Example 1:

If there are no Maintenances or they are all excluded due to the filter parameters:

```
"Asset Maintenance ID",Asset,Owner,Description,"Next Job",Started,Expires,Recurs,Status

```

#### Example 2:

Active Jobs a week ago and within the week ahead are included, "search" parameter is unused:

```
"Asset Maintenance ID",Asset,Owner,Description,"Next Job",Started,Expires,Recurs,Status
31016,"Wood (34)",test owner,"Shelves Production","18/08/2023 - api tests",2023-08-15,2023-10-17,"every 3 days",Active
31017,"Transport ()",test owner,"Company Car Fuel","15/08/2023 - api tests",2023-08-15,,"every 1 days",Active
31018,"Budget Review ()",,"Overview and Consideration","15/08/2023 - user not set",2023-08-15,,"every 14 weeks",Active
```

"Wood" has a serial number of 34\
Asset Maintenances 31017 and 31018 do not have an expiration date\
Asset Maintenance 31018 does not have a set user
