Salesforce

How Do I Define the Incoming and Outgoing Arguments in a Program? (Magic xpa 2.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Define the Incoming and Outgoing Arguments in a Program? (Magic xpa 2.x)

Programs in any computer language are designed to pass arguments in and out. Arguments coming in are passed as parameters. A parameter can pass data in, or it can receive data going out, or both.

Values going out can be coded as parameters, or, they can be coded as returned values. Returned values are typically used for programs that act as functions; that is, they can be used in the middle of an expression via a CallProg() function, but the returned value can also be received in the Result column from any Call Program operation.

Below, we explain how to enter parameters and returned values in Magic xpa.

Parameters

  1. Parameters are entered in the same way as any other variable. The only difference is, you select Parameter rather than Column or Virtual.

  2. Enter the name of the parameter. It doesn’t matter to Magic xpa what you call it, but it is a good idea to have some naming convention so the users of this program can tell if it is an incoming, outgoing, or incoming/outgoing argument. One convention is to use ‘pi’ for Parm In, ‘po’ for Parm Out, and ‘pio’ for Parm In/Out.

  3. Set the attribute and other properties as you would for any variable. It is a good idea to use Models for variables, to ensure that the fields' lengths match.

  4. It does not matter where the parameters are entered. They can be at the top of the Data View, or the bottom, or scattered between other variables. It is easier for maintenance, however, if you have a standard on where to put them; usually they are at the top of the Data View.

Magic xpa will present this list of parameters to the calling program in Magic xpa, and it is also used when creating Component, COM or SOAP objects. When you are calling this program, you will be able to see the name and data type of the parameters, and Magic xpa will syntax check the number and type of the arguments.

Note: If the calling task passes in an expression (passing by value), then obviously Magic xpa cannot update the value. So if you have a variable G, and you type G in the Var column, it can be updated. If you code an expression with G in it, then the value of G will be passed in to the program, but the variable G will not be updated. You can use expressions for passing information when you want to be certain that the value is not changed.

Returned Values

  1. Go to Task Properties->General->Return Value.

  2. Zoom to the Expression Editor.

  3. Enter an expression that will be the value you want to return.

See also

The Online and Rich Client Samples projects (program DV04 and RDV04)

Reference
Attachment 
Attachment