Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Master - Detail Links query - query
Tue, May 16 2017 5:06 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

I don't know if this is a bug, a feature or just me being thick again. When I try and open the detail query I'm getting

---------------------------
Debugger Exception Notification
---------------------------
Project TfR.exe raised exception class EDatabaseError with message 'SubBlack: Field '_Domain' not found'.
---------------------------
Break   Continue   Help  
---------------------------

I have the datasource set properly.

MASTER QUERY

SELECT
SUBSTR(_EMail,POS('@',_Email),LENGTH(_EMail)) AS _Domain,
COUNT(*) AS _Variants,
MAX(_LastDetected)AS _LastDetected
FROM emBlackOrWhite
WHERE
NOT _WhiteList
AND _Level = 0
GROUP BY _Domain
HAVING _Variants >= :Times
ORDER BY _Domain

DETAIL QUERY

SELECT
_EMail,
_Occurances,
_LastDetected
FROM
emBlackOrWhite
WHERE
_EMail LIKE :_Domain
AND NOT _Whitelist
AND _Level = 0


The code that runs it is triggered by a page change  event

procedure TemDownloadControlForm.nlhPageHolder1AfterChange(Sender: TObject; PageIndex: Integer);
begin
if PageIndex = 0 then begin
 SubBlack.Close;
 BlackAnalysis.Close;
 nlhWaiter1.WaitControl := bwGrid;
end else begin
 nlhWaiter1.WaitControl := BlackDomains;
 nlhWaiter1.Active := True;
 if not BlackAnalysis.Prepared then BlackAnalysis.Prepare;
 BlackAnalysis.ParamByName('Times').AsInteger := MinVariants.AsInteger;
 BlackAnalysis.ExecSQL;
 if not SubBlack.Prepared then SubBlack.Prepare;
 SubBlack.Open; <<<<<<<<<<<<<<<<< problem here
 nlhWaiter1.Active := False;
end;
end;




Roy Lambert
Tue, May 16 2017 5:26 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Weirder


I thought, lets try it with an after scroll event instead, and changed the parameter name

procedure TemDownloadControlForm.BlackAnalysisAfterScroll(DataSet: TDataSet);
begin
SubBlack.Close;
if not SubBlack.Prepared then SubBlack.Prepare;
SubBlack.ParamByName('XYZ').AsString := '%' + BlackAnalysis_Domain.AsString;
SubBlack.Open;
end;

---------------------------
Debugger Exception Notification
---------------------------
Project TfR.exe raised exception class EDatabaseError with message 'SubBlack: Field '_Domain' not found'.
---------------------------
Break   Continue   Help  
---------------------------

SubBlack's sql is

SELECT
_EMail,
_Occurances,
_LastDetected
FROM
emBlackOrWhite
WHERE
_EMail LIKE :XYZ
AND NOT _Whitelist
AND _Level = 0


I'm having a serious WTF moment. Deleted all the dcus just in case, checked to make sure there isn't a different version lying around. Retyped the sql just in case there's invisible ink being used. I'm now officially baffled.

Roy Lambert
Tue, May 16 2017 5:31 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Found it - it was me being thick. I copied a TEDBQuery component to save having to set session & database and it brought across some persistent fields - delete those and I'm good to go.

Roy Lambert
Image