Rename a BAM entity file

Change the filename of a BAM entity involves more than simply renaming the file from the Projects view.

Why rename a file?
Once an entity is implemented, the entity filename serves as the basis for all supporting files. For example:
  1. If the Name property of a CRUD form is "Foo", then
  2. The file created when implementing the entity is Foo.4fdm, and
  3. The files created for the application all begin with "Foo", such as Foo.4gl, Foo_common.4gl, and so on.

After implementation of an entity, you can change the logical name of the entity in the Business Application diagram; however, it does not change the entity filename on disk.

You may want to change the entity filename on disk. You may decide that it is not a good descriptor. You may want the generated file names use a different stub. To rename the physical file, you must follow these instructions.

  1. Open the project in the Projects view.
  2. Locate the entity file in the project.
    Right-click the entity in the Business Application diagram (.4ba) and select Locate in project.
  3. Right-click on the filename in the Projects view and select Rename.
    Enter in the new filename. Ensure you include the file extension.
  4. In the central work area, right-click on the Business Application diagram and select Import Project Files.
  5. Select the row with the renamed file and click the Add icon (the first icon in the toolbar).
    You can also access the Add option from the context menu for the row.
    The Action for the file changes from Process Later to Add.
  6. Click Execute Actions.
    The new filename is associated with the entity.
  7. Save and build your project.
    When you build the application, all the files created for the application use the new stub when naming the files.
  8. If you previously created any code events for the entity, you must manually copy those code events from oldfilename.4gl to newfilename.4gl.

This procedure does not remove the previous files (the application files previously generated using the old name.) You can manually delete those files using any file browser.