Salesforce

How Do I Initialize My Application? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Initialize My Application? (Magic xpa 3.x)

When you are setting up an application, there will be items you want to set up globally, before any of your programs run, and use in many programs. In Magic xpa, these items are kept in the Main Program, which is a special program at the top of the Program repository.

You can think of the Main Program as being the “parent” task of any program in the project. The Task Prefix runs before your program runs, even when you are just testing in Debug mode. You have access to any function or variable in the Main Program while your program runs. And when the project is closed, Task Suffix of the Main Program runs (or after you are finished testing your program in Debug mode).

What to set up in the Data View section of the Main Program

In the Data View section of the Main Program, you can put variables that will be used throughout the application, including OLE objects. You can initialize these variables in Task Prefix.

If you have an application that uses one type of variable a lot, such as a BLOB that is used for SOAP services, the Main Program’s Data View can be a handy place to keep that variable.

What to set up in the Logic section of the Main Program

  1. In Task Prefix, put the operations you want to have execute before any programs run. Here, we have operations to initialize tables, by moving data from saved BLOB files into Magic xpa tables. You can also call programs here, for instance, to track user logins.

  2. In Task Suffix, put the operations you want to have execute when the user is exiting the project. In this example we store the data from the tables back into BLOBs. Again, you can call programs here to perform various tasks.

  3. You can also enter Function logic units. Any functions you enter here will be globally available, and will show up on the Magic xpa function list.

  4. Event logic units will be globally available if entered here. In our example, we have set Ctrl+S to call a Spell Checker for whatever field the user happens to be on. Doing this sort of logic in the Main Program means you don’t have to do it multiple times in the individual programs.

    You can also use Event logic units to globally trap errors, using the Error type events.

  5. Variable Change logic units can be used to give messages or do logging.

Reference
Attachment 
Attachment