As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
This may be an easy question to answer but just looking for confirmation. I would like to reference a field from a join, but would this be the same as most sql statements that use the table.fieldname convention? What happens in my case is that I usually run a selection from a base table such as CARS and call it IMPORTS, then I rejoin that back with the original CARS table, but then I might have duplicate field names. If I wanted to reference the IMPORT.PRICE instead of the CARS.PRICE, would I just use PRICE or can I actually try to specify it as mentioned?
I don't see anything wrong with the code. But what's going on behind the scenes is what I was concerned with. When you join a HOLD file to a SQL table and use SUM, WebFOCUS may not be able to generate efficient SQL.
As to the Address issue, are all the addresses stored in the same table? Have you looked into the TAG attribute in the JOIN syntax?
JOIN field1 [AND field1a...] IN host [TAG tag1]TO [ALL] field2 [AND field2a...] IN crfile [TAG tag2] [AS joinname]
END
e.g.
JOIN HOME_ADD_CODE IN TABLE1 to ADD_CODE in ADD_TBL TAG HOME AS J1
JOIN WORK_ADD_CODE IN TABLE1 to ADD_CODE in ADD_TBL TAG WORK AS J2
TABLE FILE TABLE1
PRINT
HOME.ADD_LINE1 HOME.CITY
WORK.ADD_LINE1 WORK.CITY
...
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
Efficient it is not, I agree, however if you want have you considered using the ASNAMES option. TABLE FILE CAR PRINT PRICE AS IMPORT_PRICE ... ON TABLE SET ASNAMES ON ON TABLE HOLD AS IMPORTS END
Now IMPORTS will have a different name for price.
Of course, without knowing just what you are really trying to do, it seems if you are just wanting information from the file in this case 'imports' why not just pull all the data you need on the first pass?
Leah
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004
As to the tag attribute, I think I'll try it out next time.
As far as the join itself is concerned, I am not sure what would be a more efficient manner of calling the join. I understood that a call for data using joins would be returned with an answer set on the first pass. Whereas if a hold is made, there is a second pass required but I just wanted to confirm the nomenclature for declaring a field name that exists in two tables.
Leah, the ASNAMES I did not know could be done in the TABLE block. I tried something similar with COMPUTE but I can't do 'where' statements on a COMPUTE field and is why I went to defines. Are where's allowed for ASNAMES?
I was running a define that would reduce the sum of a column in question. However, since I used a sum, I could not verify what the original values were since each grouping (or BY's) had various rows. After calling the join, I could reference the original number of rows and their values to make sure that the summary was complete.
E.G.
TABLE FILE CARS SUM SALES BY CAR ON TABLE HOLD AS HOLD1 END
JOIN CAR ON HOLD1 TO ALL CAR ON CARS TABLE FILE HOLD1 PRINT HOLD1.SALES AS 'TOTAL' HOLD2.SALES AS 'UNIT' BY CAR ENDThis message has been edited. Last edited by: gregson06,
Yes if the where clause is in the hold file where the field now has a new name.
As to piece of mind, have you considered producing two reports with one pass of the data, one a summary and one a detail with the data subtotaled, then by pass the detail one once you have piece of mind.
Leah
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004
Yeah, that was a considerable option that would have save much turmoil and confusion, but I suppose that the keystrokes were a bit more comfortable. This would also have worked great, too. I will try to use the AS feature on one of my next projects as I didn't think that the AS names held in a hold. In my mentality, I figured that they were placeholders for the column names and not the actual metadata of the hold itself. In fact, you can still use the original name on the next procedure, I believe, and I think that's what threw me off of that.
Actually, just now verified it, ASNAMES does work, had not seen the ON TABLE SET ASNAMES ON declaration. In terms of efficiency, is this more recommendable than using a DEFINE? I'm not sure which would translate to SQL more fluidly.