Re: Record Prefix Behavior #ria

Keith Canniff



Not sure if I understand this correctly, so I’ll outline how Magic’s engine cycle basically works (and has since DOS)


In an Online task (not covering a Batch task here which is slightly different)


  1. Before Task Prefix
    1. Magic Passes in Parameters to the task
    2. Magic opens all tables defined as Main Source, Links, and Declares (could be controlled by passed in parameters
  2. Task Prefix takes place
    1. Instructions in Task Prefix execute
  3. Any defined sort takes place
    1. Using passed in parameters, values set in Task Prefix, Ranges in Dataview and/or Task Range Expression
  4. Before Record Prefix
    1. Magic re-retrieves the first/next record in the dataview (after any sort takes place) based on any locate specified or the first row retrieved based on the ranges and updates all real variables from the data retrieved
    2. Virtuals are initialized based on any init expression
    3. Links compute based on any data retrieved/inited
  5. Record Prefix takes place
    1. Statements are executed top to bottom
    2. Links recompute based on values changed in Record Prefix IF those variables (real or virtual) are selected AFTER the variable that’s changed (not before)
  6. Record Main (The Dataview) section is executed based on user movement through it
    1. Changes made by a user or the program (CallProg, user functions) do not re-execute operations in record prefix.
  7. Record Suffix Occurs if
    1. User changes values in the task
    2. Value is passed back from a called subtask or program (like a zoom, event, etc.)
    3. The task is defined as a Select Task
    4. Force Record Suffix is set
  8. If Record Suffix Occurs
    1. Statements are executed top to bottom
    2. Links recompute just like Record Prefix
    3. After all statements are executed, the Record(s) are written back to the table
    4. If “Force Record Delete” is true, the record suffix is executed again in “Delete” Mode which executes only statements in Record Suffix that are marked with the expression Stat(0,’D’Mode), and then deletes the current Main Source Record
  9. Return to Step 4 and repeat until user exits or the Task End Expression is true
    1. Virtual variables that are Not Inited (have an Init expression) will retain the value they had from the prior record, so they are carried forward


So the above is long winded but important. It’s late so I may have missed something (there is more detail but I don’t think it’s relevant here). If so, I’ll go find my diagram and attach it (later) 😊


Hope this clears up why your program is doing what its doing. Again, this logic has not changed since about Magic version 5.x.


Keith Canniff
President and CTO
IntegrateOne LLC




From: <> On Behalf Of Darren
Sent: Thursday, October 25, 2018 9:04 PM
Subject: [magicu-l] Record Prefix Behavior #ria


Hi Guys

So I've migrated a UnipaaS 1.9 project to Magic XPA 3.3

What I've noticed is the record prefix behavior.

In UniPaaS, I have virtual variables updated in the record prefix by a value in main source because task has a main source and only 1 record is being modified and form has no table, when I modified a value in the main source that used to update the virtual variable in the record prefix and submit the form and the virtual variable values are still retained.

However, in Magic XPA , when I submit the form it seems like it goes to record prefix again and update those virtual variable with the modification I did in the main source.

double checked ctrl+P and it was all the same.


Best Regards,



Join to automatically receive all group messages.