Where clause in BusinessProcess prevents OnLeaveRow

72 views
Skip to first unread message

Tilmann Brenk

unread,
Dec 17, 2024, 6:45:30 AM12/17/24
to Migrated By Firefly
Hello All,

I found that a Where clause in a BusinessProcess prevents OnLeaveRow when it contains a comparison between two columns in the base table.

Here is a example:
        class TestProcessReference1 : BusinessProcessBase
        {
            readonly Models.GlobalProcesses.ProcessReference processReference = new Models.GlobalProcesses.ProcessReference { ReadOnly = true };

            TEST_WhereProblem _parent;
            public TestProcessReference1(TEST_WhereProblem parent)
            {
                _parent = parent;

                From = processReference;

                Where.Add(processReference.PXPZAR.IsEqualTo(processReference.PXVPZA));
            }
            public void Run()
            {
                Execute();
            }
            protected override void OnLeaveRow()
            {
                System.Diagnostics.Debug.WriteLine($"OnLeaveRow {processReference.PXPZNR}");
            }
        }

In the debug output I see that the query is ok and returns 1528 records:
(0)-ExecuteNonQuery - sp_cursorprepexec
Query Parameters:
declare @stmt nvarchar(115) = 'Select PXPZAR, PXPZNR, PXPOSI, PXFOLG, PXVPZA, PXVPZN, PXVPOS, PXVPFO, PXMEPZ
From GBPZZU
Where PXPZAR = PXVPZA'
declare @scrollopt int = 1 /*1*/
declare @ccopt int = 98305 /*18001*/

(0)-
Result values:
declare @handle int = 1073741827
declare @cursor int = 180150007
declare @rowcount int = 1528

What am I missing here?

Thanks for any help or advice,
Tilmann Brenk

Noam Honig

unread,
Dec 17, 2024, 6:53:44 AM12/17/24
to Tilmann Brenk, Migrated By Firefly
A Quick workaround would be:
Where.Add("{0}={1}",processReference.PXPZAR,processReference.PXVPZA);

Noam Honig  
Founder & CEO


--
You received this message because you are subscribed to the Google Groups "Migrated By Firefly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to migrated-by-fir...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/migrated-by-firefly/fdac0733-af85-4789-a544-56bec876f6e1n%40googlegroups.com.
Message has been deleted

Tilmann Brenk

unread,
Dec 17, 2024, 9:47:10 PM12/17/24
to Migrated By Firefly
Hi Noam,

yes, thanks, this works fine.
So a string expression in Where is not checked the same way as a column-based Where?

Noam Honig

unread,
Dec 17, 2024, 9:50:04 PM12/17/24
to Migrated By Firefly
Hi Tilmann,

This method of `Where.Add ("{0}={1}"...` creates an sql where caluse that just gets evaluated in the database.
The original behaviour where if you do isEqualTo to the same table misbehaves, is to replicate an edge case in magic nd make sure that the behaivour is consistent to the original application

Happy holidays

Message has been deleted

Tilmann Brenk

unread,
Dec 22, 2024, 2:22:09 AM12/22/24
to Migrated By Firefly
Hi Noam,

so perhaps I could remove this edge case misbehavior, if we don't need it? 

Noam Honig

unread,
Dec 22, 2024, 2:23:37 AM12/22/24
to Tilmann Brenk, Migrated By Firefly
You could - you'll need to follow the code and find the place where every filter is also evaluated in memory, nad try removing that call and do some tests to your application

Noam Honig  
Founder & CEO

Reply all
Reply to author
Forward
0 new messages