Note that there are some explanatory texts on larger screens.

plurals
  1. POTSQL Hack needed for getting a filter for data
    text
    copied!<p>A UI (before the report shows) shows a look up (Combo) that has </p> <ul> <li>(ID = 0).All Organization Units </li> <li>(ID =4).HR</li> <li>(ID = 5).DEV</li> </ul> <p><strong>I need to:</strong></p> <ol start="4"> <li>Be able to show data of (4) + (5) if (0) is selected.</li> <li>Only (4) OR (5) if either HR or DEV is selected.</li> </ol> <hr> <p>Lookup combo code (Selected Feeds the parameter in the below query.)</p> <hr> <pre><code>Select 0 AS ID,'All Org' AS Name from DP_ORG_OrganizationUnit where DP_ORG_OrganizationUnit.Code IN {AccessData} Union SELECT DP_ORG_OrganizationUnit.ID, DP_ORG_OrganizationUnit.Name FROM DP_ORG_OrganizationUnit where DP_ORG_OrganizationUnit.Code IN ('HR','DEV') </code></pre> <hr> <hr> <p>Report data row query</p> <hr> <pre><code>SET CONCAT_NULL_YIELDS_NULL OFF DECLARE @EmpID as int; DECLARE @OrganizationUnit as int; DECLARE @StartDate as datetime; DECLARE @EndDate as datetime; SET @EmpID = ?; SET @StartDate = ?; SET @EndDate = ?; SET @OrganizationUnit = ?; SELECT Employee.Code, Employee.Name1+' '+Employee.Name2+' '+Employee.Name3+' '+Employee.Name4+' '+Employee.Name5 AS FullName, Employee.OrganizationUnit, ContractType.Name, EmployeeContract.StartDate, EmployeeContract.EndDate FROM Employee INNER JOIN (ContractType INNER JOIN EmployeeContract ON ContractType.ID = EmployeeContract.ContractType) ON Employee.ID = EmployeeContract.Employee WHERE (Employee.ID = @EmpID OR @EmpID=0) AND (Employee.OrganizationUnit = @OrganizationUnit OR @OrganizationUnit=0) AND NOT((EndDate &lt; @StartDate or StartDate &gt; @EndDate)); </code></pre> <hr> <p>Any way I can achieve it from the looks of it? 0=0 would show all the data from other departments too..</p> <p>Anybody :-o?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload