I have a SQL query that returns two columns with one and the same name. The problem is that I can not change the query.
Here is some example:
SQL
SELECT *, 'A' AS MODEL
FROM CAR;
TABLE ON TABLE HOLD AS TTT
END
-RUN
TABLE FILE TTT
PRINT *
END
This message has been edited. Last edited by: Kerry,
WebFOCUS 7.6 Windows 2000 Output: HTML, PDF
May 21, 2008, 05:50 AM
Danny-SRL
L_G,
If you look at your HOLD master file (ttt.mas) you will see that all fields have been numbered from E01 to Enn where nn is the total number of fields retrieved. That should solve your problem.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
May 21, 2008, 06:16 AM
L_G
Thanks Danny-SRL. It works
WebFOCUS 7.6 Windows 2000 Output: HTML, PDF
September 16, 2009, 12:56 PM
OnQuest
L_G,
quote:
Thanks Danny-SRL. It works
I see that your last note was in may 2008...If it is not too much trouble to look up for a sample code, can you post an example of how you got it to work?
I need to compare fields/columns from a hold file with table columns in where clause. and I'm trying to see if I can reference the hold file columns by the column number.
I tried using the hold file field names but got error that says - (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: HOLDMAX.FIELD2
Thanks!
WebFOCUS 767, Windows XP Excel, HTML, PDF
September 16, 2009, 01:23 PM
Francis Mariani
TABLE FILE CAR
SUM
SALES
BY COUNTRY
BY CAR
BY MODEL
ON TABLE HOLD AS H001
END
0 NUMBER OF RECORDS IN TABLE= 18 LINES= 18
?FF H001
FILENAME= H001
COUNTRY E01 A10
CAR E02 A16
MODEL E03 A24
SALES E04 I6
Each column in the hold file has an alias name assigned to in in the master, E01, E02, etc. You can use this alias name or the column name in the report.
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 16, 2009, 02:38 PM
OnQuest
here is an example of what I'm doing:
TABLE FILE CAR
SUM
MAX.SEATS AS 'MSEATS'
BY COUNTRY
BY CAR
ON TABLE HOLD AS H001
END
? HOLD H001
-----------------------------
DEFINITION OF HOLD FILE: H001
FIELDNAME ALIAS FORMAT
COUNTRY E01 A10
CAR E02 A16
SEATS E03 I3
TABLE FILE CAR
PRINT
COUNTRY
CAR
MODEL
SEATS
SALES
WHERE SEATS EQ E03;
ON TABLE PCHOLD FORMAT PDF
END
This gives me the error -
quote:
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: E03
is there a way to reference th hold file columns in the where clause of another table file definition?
WebFOCUS 767, Windows XP Excel, HTML, PDF
September 16, 2009, 03:04 PM
Darin Lee
You're saying TABLE FILE CAR but referencing fields from H001 - that will never work. You can join H001 and CAR, but I'n not sure if that's what you're wanting either.
You can also create a hold file that basically is a list of the field values you want to use. Then you can say WHERE fieldname IN FILE filename. Look up Creating Reports With WebFOCUS Language > Selecting Records for Your Report > Reading Selection Values From a File
There are limitations on the size of the referenced file.
Regards,
Darin
In FOCUS since 1991 WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex WF Client: 77 on Linux w/Tomcat