mjcmkrsr
Technical User
- Nov 30, 2010
- 840
Hi,
This code executed from a page's click event works fine and the results are correct
but I want to toggle the value of chkEmail and make the results depending on it. However the following code throws an error: Alias chkEmail not found
Hence my question: does HAVING not accept conditional settings
Thanks
MarK
This code executed from a page's click event works fine and the results are correct
Code:
Select Stagiaires.cName, ;
Stagiaires.cGender, ;
Stagiaires.dBirth, ;
Stagiaires.cEmail, ;
NVL(COUNT(Students.dEntry), 0), ;
NVL(MIN(Students.dEntry), {}), ;
NVL(MAX(Students.dExit), {}), ;
Stagiaires.PKey ;
From Stagiaires ;
LEFT JOIN Students ON Stagiaires.PKey = Students.PKey ;
Where IIF(This.chkEmail.Value = .T., AT("@", Stagiaires.cEmail) != 0, .T. ;
GROUP BY 1, 2, 3, 4, 8 ;
[highlight #FCE94F]HAVING DATE() - MAX(Students.dExit) < 3650 ;[/highlight]
Order by 1, 3 ;
Into Cursor curStagiaires
but I want to toggle the value of chkEmail and make the results depending on it. However the following code throws an error: Alias chkEmail not found
Code:
Select Stagiaires.cName, ;
Stagiaires.cGender, ;
Stagiaires.dBirth, ;
Stagiaires.cEmail, ;
NVL(COUNT(Students.dEntry), 0), ;
NVL(MIN(Students.dEntry), {}), ;
NVL(MAX(Students.dExit), {}), ;
Stagiaires.PKey ;
From Stagiaires ;
LEFT JOIN Students ON Stagiaires.PKey = Students.PKey ;
Where IIF(This.chkEmail.Value = .T., AT("@", Stagiaires.cEmail) != 0, .T. ;
GROUP BY 1, 2, 3, 4, 8 ;
[highlight #FCE94F]HAVING IIF(This.chkEmail.Value = .T., DATE() - MAX(Students.dExit) < 3650, .T.) ;[/highlight]
Order by 1, 3 ;
Into Cursor curStagiaires
Hence my question: does HAVING not accept conditional settings
Thanks
MarK