# File Maintenance Objects (Legacy)

> Source: https://manual.pvxplus.com/nomads-graphical-application/program-interaction/object-oriented-programming/file-maintenance-objects

Important Note:

*This page is for historical reference only.*  
  
As of PxPlus 2019, a new [File Maintenance Generator](https://manual.pvxplus.com/nomads-graphical-application/dictionary-based-development/fmgen/fmgen-introduction) was created to make it easier to generate file maintenance (or inquiry-only) panels. As of PxPlus 2021, it can also be used to generate HTML pages.

The legacy version of the NOMADS File Maintenance Generator interface includes two *Program Type* options for creating file maintenance panels - ***Generic Object*** and ***Custom Object***. For either option, the File Maintenance Generator will build a panel with no logic attached for the panel or the controls. The event logic for a file maintenance panel is encapsulated in the methods of the maintenance program.

## File Maintenance Objects

The Generic Object uses two standard programs: **\*win/flmaint.pvc** and **\*win/flmaintio.pvc**. All file IO is handled by the **flmaintio.pvc** program, while **flmaint.pvc** handles all the panel and control events. The **flmaint.pvc** program inherits both the NOMADS object, **\*nomads.pvc** and **flmaintio.pvc**.

If the *Program Type* is Custom Object, then a custom program will be generated. The same methods used by the generic object **flmaint.pvc** will be added to the custom program. The folder methods, such as DefaultFolderPreload( ), will be declared only if the maintenance panel is generated with the Folders option selected.

***Flmaint*** ***Object***

Below is a list of methods in **flmaint.pvc**.

| **Methods** | **Description** |
| --- | --- |
| **Button_Cancel**( ) | Check if current record has been changed and close panel. Return value is ignored. |
| **Button_Clear**( ) | Clear record inputs/fields. Return value is ignored. |
| **Button_Del**( ) | Delete current record. Return value is ignored. |
| **Button_First**( ) | Get first record on file. Return value is ignored. |
| **Button_Last**( ) | Get last record on file. Return value is ignored. |
| **Button_Next**( ) | Get next record on file. Return value is ignored. |
| **Button_Prior**( ) | Get prior record on file. Return value is ignored. |
| **Button_Write**( ) | Write current record. Return value is ignored. |
| **DefaultChange**( ) | ***(Internal Use Only)*** Read current record. This logic will only execute if the control name is part of the key definition. Return value is ignored. |
| **DefaultInitialize**( ) | ***(Internal Use Only)*** Setup key definition fields, required fields and numeric fields. Return value is ignored. |
| **DefaultOnFocus**( ) | ***(Internal Use Only)*** Check if current record has been changed and enable/disable field inputs. Return value is ignored. |
| **InitializeFolder_Tab_1**( ) | ***(Internal Use Only)*** Build tab direction and NEXT_FOLDER string. Sets up the hidden multi-line control Folder_Tab_1. Return value is ignored. |
| **InitializeFolder_Tab_2**( ) | ***(Internal Use Only)*** Build tab direction and NEXT_FOLDER string. Sets up the hidden multi-line control Folder_Tab_2. Return value is ignored. |
| **InitializeFolder_Tab2M**( ) | ***(Internal Use Only)*** Build tab direction and NEXT_FOLDER string. Sets up the hidden multi-line control Folder_Tab_2M. Return value is ignored. |
| **OnFocusFolder_Tab_1**( ) | ***(Internal Use Only)*** On focus logic for hidden multi-line control Folder_Tab_1. Return value is ignored. |
| **OnFocusFolder_Tab_2**( ) | ***(Internal Use Only)*** On focus logic for hidden multi-line control Folder_Tab_2. Return value is ignored. |
| **OnFocusFolder_Tab_2M**( ) | ***(Internal Use Only)*** On focus logic for hidden multi-line control Folder_Tab_2M. Return value is ignored. |
| **OnExit**( ) | ***(Internal Use Only)*** Panel header on exit logic. Reset message library, parameters and close file. Return value must be 1 in order to allow the panel to terminate.  <br>  <br>If the method returns 0, then the panel will not be closed. |
| **PostLoad**( ) | ***(Internal Use Only)*** Build tables from embedded file info, enable/disable input fields, validate ARG_1$ and load a default record. Return value is ignored. |
| **DefaultFolderPostLoad**( ) | ***(Internal Use Only)*** Enable/disable groups and assign NEXT_ID depending on the tab direction variable Tab_Flg$. Return value is ignored. |
| **PreLoad**( ) | ***(Internal Use Only)*** Activate message library, open file, initialize variables. Return value is ignored. |
| **DefaultFolderPreLoad**( ) | ***(Internal Use Only)*** Build first tab and last tab string (used to control tab direction). Return value is ignored. |

***Flmaintio*** ***Object***

Below is a list of methods in **flmaintio.pvc**.

| **Methods** | **Description** |
| --- | --- |
| **Delete**( ) | ***(Internal Use Only)*** Delete current record. Returns **1** if successful, **0** if unsuccessful. |
| **Extract**(\_*ReviewRec)* | ***(Internal Use Only)*** Lock record.   <br>  <br>\_*ReviewRec* - If **1**, then extract the record using an alternate IOList. Default is **0**. Returns **1** if successful, **0** if unsuccessful. |
| **KeyAfterNext**( ) | ***(Internal Use Only)*** Return key after next record. Returns **1** if successful, **0** if unsuccessful. |
| **OpenFile**(\_*File_Name$*) | ***(Internal Use Only)*** Open file.   <br>  <br>*\_File_Name$* - Name of physical file. Returns **1** if successful, **0** if unsuccessful. |
| **ReadByKey**(*Keyno*,*Seg1$*,  <br>*Seg2$*,*Seg3$*,*Seg4$*,*Seg5$*) | ***(Internal Use Only)*** Read file using key number and key segments.  <br>  <br>*KeyNo* - Key number  <br>*Seg1$* - Key segment 1  <br>*Seg2$* - Key segment 2 (optional)  <br>*Seg3$* - Key segment 3 (optional)  <br>*Seg4$* - Key segment 4 (optional)  <br>*Seg5$* - Key segment 5 (optional)  <br>  <br>Returns **1** if successful, **0** if unsuccessful. |
| **ReadFirst**( ) | ***(Internal Use Only)*** Return first record using same key. Returns **1** if successful, **0** if unsuccessful. |
| **ReadLast**( ) | ***(Internal Use Only)*** Return last record using same key. Returns **1** if successful, **0** if unsuccessful. |
| **ReadNext**( ) | ***(Internal Use Only)*** Return next record using same key. Returns **1** if successful, **0** if unsuccessful. |
| **ReadNext**(*N$*) | ***(Internal Use Only)*** Return next record on file using an alternate key name or key number.   <br>  <br>*N$* - Alternate key name or key number. Returns **1** if successful, **0** if unsuccessful. |
| **ReadPrevious**( ) | ***(Internal Use Only)*** Return prior record using same key. Returns **1** if successful, **0** if unsuccessful. |
| **Update**(\_*KeyType*) | ***(Internal Use Only)*** Update current record.  <br>  <br>*\_KeyType* - Set to **1** if the file contains an external key. Default is **0**. Returns **1** if successful, **0** if unsuccessful. |

## Invoking an Object

A file maintenance panel is invoked as follows:

```
O=new("<.pvc program>","<panel name>","<library name>")
O'Process(arg_1$,arg_2$.....arg_20$)
```

In the above syntax, the *arg_1$* through *arg_20$* are optional.

***Example:***

The following example uses the generic object:

```
Cust_Id $="0001"
O=new("*win/flmaint","Customer","Mylib.en")
O'Process(Cust_Id$)
```

Data for customer 0001 will automatically be loaded after the panel is displayed.

## Customizing a File Maintenance Program

The program created for a Custom object is designed to allow customization.

You can also create customized code for a Generic object if you wish. Save **\*win/flmaint.pvc** under a new name and enter this name in the Maintenance Program input field. The program name must contain a ***.pvc*** extension.

## Customizing a File Maintenance Panel

The File Maintenance Generator includes two Button Location options for the browse/edit buttons on the panel - *Bottom* (default) or *Side*. The browse and edit buttons for the objects can be found in the library **\*win/scrnlib.en**. The **flmaintobj** panel contains a horizontal button set and the **flmaintobj.v** panel contains buttons that appear vertically on the side of the generated panel.

To customize buttons on file maintenance panels, copy the **flmaintobj** panels to an alternate library and load the global variable **%Flmaint_Lib$** with the alternate library name. NOMADS will then use these custom panels when generating a new file maintenance panel.
