Advanced Query Help

Advanced Query Help

  
First of all, I'm trying to get a list of employees based on a rule.  For instance, all employees in North America and Europe regions.  However, my query appears to only be returning a limited number of results.  I attempted a regular query but wasn't getting the results I was expecting.

SELECT {EMPLOYEE}.* from {RULE_LOCATION}, {LOCATION}, {FACILITY}, {EMPLOYEE}
WHERE {RULE_LOCATION}.[RuleId] = @RuleId
and (   {RULE_LOCATION}.[LocationId] = {LOCATION}.[Id] or
        {RULE_LOCATION}.[IncludeChildLocations] = -1 and {RULE_LOCATION}.[LocationId] = {LOCATION}.[ParentLocationId]
    )
and {FACILITY}.[LocationId] = {LOCATION}.[Id]
and {EMPLOYEE}.[FacilityId] = {FACILITY}.[Id]

ORDER BY {EMPLOYEE}.[First_Name], {EMPLOYEE}.[Last_Name]

Second, Is there a way in advanced queries to use the dynamic sort parameters so users could sort on the data list columns?

Thanks in advance!

You can use ORDER BY @DynamicOrderBy, where DynamicOrderBy is a query parameter with Expand Inline set to Yes

Best Regards,
Gustavo Guerra