g.V().has('organizationId', 'b121672e-8049-40cc-9f28-c62dff4cc2d9').
as('emp').
outE('hasStatus').
inV().
or(
has('endDate', gte(1587820000)),
has('release', is(false))
).
as('x').
values('status').
choose(is('Red'), constant(1),
choose(is('Orange'), constant(2),
choose(is('Yellow'), constant(3), constant(4)) ) ).
as('priority').
project('EmployeeId', 'FirstName', 'LastName','Email','PhoneNumber','Department',
'Status','EndDate').
by(select('emp').by('id')).
by(select('emp').by('firstName')).
by(select('emp').by('lastName')).
by(select('emp').by('email')).
by(select('emp').by('phoneNumber')).
by(select('emp').by('department')).
by(select('x').by('status')).
by(select('x').by('endDate')).
order().
by(select('priority')).
group().
by(select('emp').by('id')).
by(limit(1)).
unfold().
select(values)
Above is the Query to get employee list with its current active status, here I am getting employees list who are having current active status, but I need those employees also who still don't have any status present yet, I need a query to get all employee list with its status if present and if the particular employee doesn't have status these employees list should also display with null status in this list.
Maybe you can try something like this:
g.V().has('organizationId', 'b121672e-8049-40cc-9f28-c62dff4cc2d9').
where(or(
out('hasStatus').or(
has('endDate', gte(1587820000)),
has('release', is(false))
),
out('hasStatus').count().is(0)
)).
project(
'EmployeeId',
'FirstName',
'LastName',
'Email',
'PhoneNumber',
'Department',
'Status',
'EndDate'
).by(id).
by('firstName').
by('lastName').by('email').
by('phoneNumber').
by('department').by(coalesce(
out('hasStatus').values('status'),
constant('no status')
)).
by(coalesce(
out('hasStatus').values('endDate'),
constant('no end date')
)).
order().
by(select('Status').
choose(
is('Red'),
constant(1),
choose(
is('Orange'),
constant(2),
choose(
is('Yellow'),
constant(3),
choose(
is('Green'),
constant(4),
constant(0)
)
)
)
))
example: https://gremlify.com/8t