Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

RAD tool advanced filter generation with Booleans properties seems to be broken? #9253


User avatar
0
marble68 created

-> 8.9, Jquery

When the RAD tool scaffolds an entity with a boolean property, that uses filtering, it generates WHEREIF statements such as

.WhereIf(input.HasScheduleFilter > -1, e => (input.HasScheduleFilter == 1 && e.HasSchedule) || (input.HasScheduleFilter == 0 && !e.HasSchedule))

What I'm seeing is the input object's int property is 0 by default, resulting in it always being filtered.

Is anyone else experiencing this, or am I doing something wrong.

If I'm doing it correctly, then my solution has been to set a default value for boolean properties in the GetAll<entity>Input class, such as:

public int HasScheduleFilter { get; set; } = -1;

For scaffolding purposes, I'd suggest setting that default value for boolean properties (which are ints in the input class it creats) in the GetAllForLookupTableInput template files for RAD tool, if you're going to use this logic for the WhereIf, to avoid having to explicitly set this to -1 when doing something like:

            var Object = await _<entity>AppService.GetAll(new GetAll<entity>Input()
            {
                
                HasScheduleFilter = -1,
                
            });

2nd question - does my setting these default values to -1 raise any potential issues I'm not aware of?


3 Answer(s)