dboVEntityRow in the TypedViewClasses NameSpace

Posts   
 
    
PierreCB
User
Posts: 13
Joined: 24-Jul-2020
# Posted on: 30-Jul-2020 14:09:57   

how to work with the dboVEntityRow in the TypedViewClasses space. Do you have an example?

i use selfServicing.TwoClasses


here is what i tried

    Dim traduction As New VTraductionCollection

    Dim filter As New PredicateExpression(VTraductionFields.ModuleID.Equal(1).And(VTraductionFields.LangueID.Equal(1)))

    traduction.GetMulti(filter)
    Dim List As New Dictionary(Of Integer,TypedViewClasses.dboVTraductionRow)

    For Each td as VTraductionEntity In traduction
        List.Add(td.TraductionID,td)
    Next
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 30-Jul-2020 18:28:45   

You looked at the typedview docs?

https://www.llblgen.com/Documentation/5.7/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/SelfServicing/Using%20TypedViews,%20TypedLists%20and%20Dynamic%20Lists/gencode_usingtypedview.htm

What you're doing is fetching an entity and then create add the values of that to a dictionary, those aren't typed view rows simple_smile

Frans Bouma | Lead developer LLBLGen Pro
PierreCB
User
Posts: 13
Joined: 24-Jul-2020
# Posted on: 30-Jul-2020 21:05:50   

Thank you very much!

In the meantime, I understood the difference between the different ways of creating views. Now I'm really stuck. I can't check if a field is null.

here's what to write as a filter

Dim filter As New PredicateExpression( LogFields.DateAlive.LesserThan(DateTime.Now.Subtract(New TimeSpan(2, 0, 0))))

    filter.AddWithAnd(LogFields.LogOut.IsNull())

it doesn't work

however, this works, but I want to check if the field is null. filter.AddWithAnd(LogFields.LogOut.IsNotNull())

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 31-Jul-2020 08:27:40   

I can't reproduce it. Both IsNull() and IsNotNull() are working perfectly, producing the correct SQL and returning the expected results.

When you say they are not working, do you mean they are not generating the correct SQL, or not returning the expected results?

If the later, then I suggest you examine the generated SQL, if the predicate is there, then there might be some other filtering messing out with the expected results.

Check the Troubleshooting section of the documentation to know how to get the generated SQL in the trace output window.

PierreCB
User
Posts: 13
Joined: 24-Jul-2020
# Posted on: 31-Jul-2020 14:47:37   

LogFields.LogOut.IsNotNull returns an IPredicate.

LogFields.LogOut.IsNull() returns a boolean

I have to pass an "IEntityFieldCore" object to the function ( LogFields.LogOut.IsNull(field as IEntityFieldCore)) to get an IPredicate.

How do I get an IEntityFieldCore object?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 01-Aug-2020 09:41:47   

PierreCB wrote:

LogFields.LogOut.IsNotNull returns an IPredicate.

LogFields.LogOut.IsNull() returns a boolean

There's a property 'IsNull', not sure if VB.NET allows you to access that property with () as if it's a method call, in case it does, that's the reason you see this, sadly not something we can fix...

I have to pass an "IEntityFieldCore" object to the function ( LogFields.LogOut.IsNull(field as IEntityFieldCore)) to get an IPredicate.

How do I get an IEntityFieldCore object?

You can do:

Dim predicate = IsNullPredicateProducers.IsNull(LogFields.LogOut)

Another way is the old fashioned way:

Dim predicate = new FieldCompareNullPredicate(LogFields.LogOut)

or

Dim predicate = LogFields.LogOut = Nothing
Frans Bouma | Lead developer LLBLGen Pro
PierreCB
User
Posts: 13
Joined: 24-Jul-2020
# Posted on: 04-Aug-2020 17:01:32   

Thank you very much Otis ! simple_smile

here's how it worked for me at VB.net.

Dim logcol As New LogCollection Dim filter As IPredicateExpression = New PredicateExpression(IsNullPredicateProducers.IsNull(LogFields.LogOut)) logcol.GetMulti(filter)