PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → [WD15] HFCS SQL issue
[WD15] HFCS SQL issue
Iniciado por guest, 15,nov. 2014 18:39 - 4 respuestas
Publicado el 15,noviembre 2014 - 18:39
Hello

I'm migrating a HF Classic application towards HF Cllient/Server and have had several problems with SQL code running in Classic but not HFCS. I can't find a solution for following query, which runs perfectly in HF Classic but not in HFCS. The error message "Report file is not in the FROM clause", doesen't make sense to me. Anyboday having any idea? Thanks.
Mat
Publicado el 15,noviembre 2014 - 18:42
sorry, forgot to add the query....

SELECT
Report.IDReport AS IDReport,
Report.ReportType AS ReportType,
Report.ShortName AS ShortName,
Report.IsCustom AS IsCustom,
Report.WindowName AS WindowName,
Report.IsActive AS IsActive,
Report.ReportName AS FileName,
Report.Destination AS Destination,
ReportML.Report AS RepName,
ReportML.IDLanguage AS IDLanguage
FROM
Report LEFT OUTER JOIN ReportML ON (Report.IDReport = ReportML.IDReport)
WHERE
(
Report.IsActive = 1
AND Report.WindowName = 'winProcessing'
AND Report.ReportType IN ('PROCESSING', 'STOCK TRANSACTION', 'STOCK CHECK LIST')
AND ReportML.IDLanguage = 0
)
UNION
SELECT
Report_Samil.IDReport AS IDReport,
Report_Samil.ReportType AS ReportType,
Report_Samil.ShortName AS ShortName,
Report_Samil.IsCustom AS IsCustom,
Report_Samil.WindowName AS WindowName,
Report_Samil.IsActive AS IsActive,
Report_Samil.ReportName AS FileName,
Report_Samil.Destination AS Destination,
ReportML_Samil.Report AS RepName,
ReportML_Samil.IDLanguage AS IDLanguage
FROM
Report_Samil Left OUTER JOIN ReportML_Samil on (Report_Samil.IDReport = ReportML_Samil.IDReport )
WHERE
(
Report_Samil.IsActive = 1
AND Report_Samil.WindowName = 'winProcessing'
AND Report_Samil.ReportType IN ('PROCESSING', 'STOCK TRANSACTION', 'STOCK CHECK LIST')
AND ReportML_Samil.IDLanguage = 0
)
ORDER by RepName Asc
Publicado el 16,noviembre 2014 - 00:12
No point wasting more time over yet another inconsistency in the HF query engine. Maybe the reason is that the second set of files is defined via hDeclareExternal, though they are found by HFileExist. The two queries work OK when run independently.in HFCS.

I chose workaround by adding the result of the second query to the first.

Mat

IF NOT HExecuteSQLQuery(dsReport2,sQuery) THEN Info(HErrorInfo) ; RESULT False END FOR ALL dsReport2 HCopyRecord(dsReport,dsReport2) HAdd(dsReport) END
Publicado el 17,noviembre 2014 - 09:58
Hi,

Do you really need to use version 15 of the HFCS database? I once had the same kind of
issue with version 15 of the HFCS database. The problem disappeared just by updating the database to version 17 or later.

Kind regards,

Joris.
Publicado el 17,noviembre 2014 - 14:46
thanks Joris, I did upgrade and check the server version 19 before posting. Also, I have other UNION queries that work alright in HFCS. What beats me is that these queries are simple and both work alright when being run independently.

Mat