OnClause from PredicateExpression Value To Value Comparison

Posts   
 
    
User001
User
Posts: 2
Joined: 19-Nov-2024
# Posted on: 19-Nov-2024 03:38:43   

Hi, everyone. To write OnClause predicate expression should be written like this:

Example: iEntityFieldA and iEntityFieldB are variables that store such as
iEntityFieldA = OrdersField.CustomerId (CustomerId field from table Orders)
iEntityFieldB = CustomersField.CustomerId (CustomerId field from table Customers)
alias = simply put a name to identify
IPredicate onClause = new PredicateExpression();

onClause = iEntityFieldA.SetObjectAlias(alias).Equal(1);                    

or

onClause = iEntityFieldA.SetObjectAlias(alias).Equal(iEntityFieldB.SetObjectAlias(alias));                    

We all know that the above are accepted by LLBL PredicateExpression and it is also valid when writing this in SQL. However, value to value comparison in OnClause is also valid statement in SQL like this statement below

SELECT * FROM Orders LEFT OUTER JOIN Customers ON 1 = 1;

The 1 = 1 in the onClause is a valid onClause statement, but the result will be somewhat silly since all return true. Despite this, user should be able to configure like this In C# but I don't seem to find any function from LLBL available.

Is there anything similar to a function so that I could achieve like how it is in SQL? Thank you very much, I appreciate kinds of replies.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39760
Joined: 17-Aug-2003
# Posted on: 19-Nov-2024 08:45:36   

Isn't A left join B on 1=1 equal to A cross join B ? What's the use case for this particular on clause?

Frans Bouma | Lead developer LLBLGen Pro
User001
User
Posts: 2
Joined: 19-Nov-2024
# Posted on: 26-Nov-2024 02:39:12   

Thanks for the reply. I thought that it could work in SQL for OnClause since SQL could do the same, not only that, it might work for WhereClause. Nevertheless, I think I have no problem for now since the left Operand must be field type and it is not necessary to do value to value for now.

Thanks again.