Main Source Properties (Magic xpa 3.x)

« Go Back


Created ByKnowledge Migration User
Approval Process StatusPublished

Main Source Properties (Magic xpa 3.x)

When you are parked on the Main Source entry in the Data View Editor, the Main Source property sheet appears. If it does not appear, press Alt+Enter, or select Properties from the Edit menu or the context menu.

In the Main Source property you select a data source from the Data repository. This data source’s records will be scrolled by the executed task.

In Online, Rich Client, or Browser tasks, the end user browses the Main source by moving from record to record. This means that the only records processed are those browsed by the end user.

In a Batch task, Magic xpa loops automatically through the data source. See also Batch Task Behavior.

The Main Source property is not accessible if the task has an SQL command.

You can leave the default zero as the Main Source definition if you want to specify use of the Scratch File instead of a database file. This is a technique used to cause Batch tasks to loop, because Scratch files are assumed to be endless. In Online tasks, you can use the Scratch file for writing general non-database-related tasks, such as implementing customized menus or setting up properties for report forms.

The Main Source properties are listed below.



Data Source Number

The number of the data source to be used. The records of the data source are scrolled by the executed task. The Data Source property is not accessible if the task has a direct SQL command.

Data Source Description

Displays the data source name. You can change the name to better distinguish repeated occurrences of the data source name, but you cannot leave it blank.

You can use this property to specify the physical database that will execute the SQL Command. SQL Commands can be issued to only one database, and cannot refer to the repositories residing in two physically separated databases. You can obtain a data view composed of repositories in more than one database, by using Magic xpa’s built-in support.


The default index is the data object's first index in the Index repository. The choice of a specific index determines the fetching sequence of the data view records for this task. You can also specify the index by creating an Index Expression.

For an SQL data source, the index sends an ORDER BY clause to the underlying database.

Setting the Index value to zero and not using an index expression causes the data object to be scanned in physical order without the use of any index.

The Index property is not accessible if the task has a SQL command.

See also:

How Do I Dynamically Change the Display Order of Records in a Program?

How Do I Determine the Order of the Records Retrieved from the Database?


The Access property is relevant only in a multi-user environment. This property determines how the repository is accessed by multiple users.

Use Read for Read Only access or Write for Read and Write access.

When adding a link to a program, it will be defined with the Access property set according to the link type:

  • Changing a link to Link Query, Link Join, or Link Outer Join will change the Access property of the link to Read.

  • Changing a link to Link Write or Link Create will change the Access property of the link to Write.

When performing APG to generate a program which should have links, the Access mode will be Read.

A special setting called SpecialLinkWriteAccess can be used to support behavior from previous versions (where the default was Write).

For local data sources, this property is not supported and is considered as Write.

For more details on Access/Share mode, refer to Multi-User Deployment Considerations.

See also How Do I Access a Data Source for Read-only in a Task?

Data Source Name

This property lets you create an expression that determines the physical name of the data source in runtime. If this property has no value, Magic xpa uses the data source name defined in the Data repository and designated by the selected value in the Data Source Number property.

The advantage of this property is that it lets you set different data sources with the same data structure. The expression used to determine the physical name of the data source will only be used if this entry was not already used to open a data source in an ancestor task. In such cases, the name set in the expression will be disregarded.

XML Source Variable

The XML Source Variable column is only available for XML sources. In this column you can specify a BLOB variable, through which you transfer the XML. The task will read and/or write to this variable.

You can zoom to the Variable list, which displays the BLOB variables of the current task and its ancestors.

See also How Do I Access an XML Document Stored in a Magic xpa Data Variable?


The Share property is relevant only in a multi-user environment. This property determines how other, concurrent tasks can access the table.

You can select the Read option to let other tasks have Read Only access. You can select the Write option (the default) to let other tasks have Read and Write access, which effectively locks the row. You can select None for no shared access, which means the table is locked.

The Access and Share combination is used to automatically determine the Open mode of the repository. Access Write with Share Write implies row locking, while Access Read and Write with Share Read implies table sharing. Share None implies exclusive use of the table.

See also Multi-User Deployment Consideration, Access/Share – XML and Access/Share – XML Runtime.

Related Topics

How Do I Determine Access Between Multiple Users for a Data Source, Within a Task?


The Open mode options are:

Normal – The Open mode for a valid table for all normal purposes.

Reindex – The Reindex Open mode is available only for ISAM databases. The Reindex Open mode instructs Magic xpa to drop all the indexes of the table when opening it, and process and rebuild the indexes upon session termination. Reindex Open mode is a performance-enhancing feature, for large table imports in Create mode, or for massive index value modification to a table. By removing all the indexes in sequential processing, Magic xpa saves the index-maintenance time normally required for every insert and modify index operation performed by the underlying database manager, such as balancing the B-tree in Btrieve. When the process ends, Magic xpa builds the index structure once for the whole table.

The Reindex Open mode depends on support by the underlying database gateway. Note that when specifying Reindex Open mode, if duplicate index values were entered in a unique index, the re-indexing process may give unexpected results. For instance, Btrieve simply aborts the re-indexing process. Other database gateways may skip the duplicate rows.

Identify Modified Row

You can have Magic xpa indicate the select rows that have been modified by another user, before updating your database.

Magic xpa can identify and select records according to the following options:

  • Position

  • Position and selected fields

  • Position and updated fields

  • As table

This property applies only for deferred transaction mode tasks and SQL or ISAM tables.

For XML sources, this column is set to As Table and is disabled. The file is set to Share = None.

See also Identify Modified Row – Multi-User.

Related Topics