Record Prefix Behavior #ria


Darren
 

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,

Darren


Keith Canniff
 

Darren,

 

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
www.integrateone.com
678-485-8665

 

 

 

From: main@magicu-l.groups.io <main@magicu-l.groups.io> On Behalf Of Darren
Sent: Thursday, October 25, 2018 9:04 PM
To: main@magicu-l.groups.io
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,

Darren


Virus-free. www.avast.com


Darren
 

I understand, but my point is they have exactly the same order properties.

I simulated the problem please check attachment,


Govert Schipper
 

Hi Darren,


Instead of updating the Virtual in the Record Prefix, you could use an Init Expression on it. Just make sure that the Select Virtual is placed somewhere BEFORE the Select Real column that is used in the Init Expression, otherwise it will be re-evaluated after you update the Real.


Govert



Van: main@magicu-l.groups.io <main@magicu-l.groups.io> namens Darren <darren.jimenez@...>
Verzonden: vrijdag 26 oktober 2018 08:23
Aan: main@magicu-l.groups.io
Onderwerp: Re: [magicu-l] Record Prefix Behavior #ria
 

I understand, but my point is they have exactly the same order properties.

I simulated the problem please check attachment,


Darren
 

Hi Govert,

Yes I tried all of that and it worked on a dummy program that I made, simple program with 1 main source 2 virtuals.

But when I tried it on the actual program, it is still doing the same.

Is there some kind of trigger to force it to go to record prefix first?

 

Regards,
Darren


Govert Schipper
 

Hi Darren,


The Record Prefix level is automatically executed for each record in the Logic. If there is only one record than it will be executed once, just before user interaction takes place. But if you want to update Virtuals with values from the data record that is being updated, you should put these updates in the Record SUFFIX instead.


Govert



Van: main@magicu-l.groups.io <main@magicu-l.groups.io> namens Darren <darren.jimenez@...>
Verzonden: maandag 29 oktober 2018 04:10
Aan: main@magicu-l.groups.io
Onderwerp: Re: [magicu-l] Record Prefix Behavior #ria
 

Hi Govert,

Yes I tried all of that and it worked on a dummy program that I made, simple program with 1 main source 2 virtuals.

But when I tried it on the actual program, it is still doing the same.

Is there some kind of trigger to force it to go to record prefix first?

 

Regards,
Darren


Darren
 

Hi Govert,

What I want is to update the virtual variable before user interaction that's why I placed it in the Record Prefix.

But when I clicked Save and Close button, it would still go to Record Prefix as you have seen in the screenshot I sent and update those variables again which I do not want to happen.

Regards,
Darren


Tim Downie
 

Just put a block around what you want to execute once in rp...inside it set virtual executed = true....cnd on block not(executed)
From: main@magicu-l.groups.io <main@magicu-l.groups.io> on behalf of Darren <darren.jimenez@...>
Sent: Tuesday, 30 October 2018 1:58:56 AM
To: main@magicu-l.groups.io
Subject: Re: [magicu-l] Record Prefix Behavior #ria
 

Hi Govert,

What I want is to update the virtual variable before user interaction that's why I placed it in the Record Prefix.

But when I clicked Save and Close button, it would still go to Record Prefix as you have seen in the screenshot I sent and update those variables again which I do not want to happen.

Regards,
Darren


Andreas Sedlmeier
 
Edited

Hi Darren,

This issue sounds like a pretty dramatic bug to me. So you have to pay for it and report it :)

There's however events which would force record prefix for a record another time, like a view refresh I think. So you should enable all logging and look into activity monitor to see the order of events, ... . That will give you much more insight than your test code with the message

Best regards,

Andreas


Ulrich Ahrendt
 

Hi Darren,

you wrote "...But when I clicked Save and Close button, it would still go to Record Prefix..". I gues, that you use an user event. Is this event set to "Post Record Update"?

Regards,
Ulrich


Darren
 

Hi Andreas,

Yes I have filed a ticket in magic community and send them a reproducible project, and they are currently investigating it now.


Thank you and Best Regards,
Darren