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.
Does anyone have an example or explanations on how to join a WF Table File within an SQLDBC query?
I built a WF table file (CARLIST) holding a list of cars that I would like to use to limit the number of records brought back while running an SQL query against our railcar DW table (CARMOVES) with millions of records. Here is an example of what I have tried so far, but due to the number of car records in the CARMOVES table - this times out.
SQL SQLDBC
SELECT car, waybill, nettons
FROM dw database.car_movement_table A
WHERE A.CAR IN FILE CARLIST ; TABLEF FILE SQLOUT ON TABLE HOLD AS X TABLE FILE X PRINT *This message has been edited. Last edited by: FP Mod Chuck,
WF 8.2
Posts: 22 | Location: US | Registered: September 28, 2017
instead of creating a hold file , you can directly join your tables in sql Passthrough ,
OR if you have limited records in hold file catlist you can read the records and assign those records to a variable using loop . and then pass that variable in where statement .
Try This code,
-DEFAULTH &CAR_UNIT = '';
-SET &CAR_FILTER = '';
-SET &ECHO = ALL;
-RUN
TABLE FILE CAR
BY CAR AS 'CAR_UNIT'
ON TABLE SET ASNAMES ON
ON TABLE HOLD AS CAR_LIST
END
-RUN
-SET &CAR_FILTER = '(';
-REPEAT :FILTERCAR &LINES TIMES
-READFILE CAR_LIST
-SET &UNITLEN = ARGLEN(&CAR_UNIT.LENGTH,&CAR_UNIT,'I2') ;
-SET &CARUNIT= TRIM('T',&CAR_UNIT, &CAR_UNIT.LENGTH, ' ', 1, 'A&UNITLEN.EVAL');
-SET &CAR_FILTER = &CAR_FILTER ||''''||&CARUNIT||''',';
-:FILTERCAR
-SET &CAR_FILTER = SUBSTR(&CAR_FILTER.LENGTH, &CAR_FILTER.QUOTEDSTRING, 1, &CAR_FILTER.LENGTH - 2 , &CAR_FILTER.LENGTH - 2, 'A&CAR_FILTER.LENGTH') || ''')';
SQL SQLDBC
SELECT car, waybill, nettons
FROM dw database.car_movement_table A
WHERE A.CAR IN &CAR_FILTER;
Run time code will become like ,
SQL SQLDBC
SELECT car, waybill, nettons
FROM dw database.car_movement_table A
WHERE A.CAR IN ('ALFA ROMEO','AUDI','BMW','DATSUN','JAGUAR','JENSEN','MASERATI','PEUGEOT','TOYOTA','TRIUMPH') ;
DEFINE FILE CAR
QCAR/A20='''' || CAR || ''',';
END
TABLE FILE CAR
SUM CNT.CAR
SUM QCAR
ACROSS CAR
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS CAR_LIST
END
-RUN
-READ CAR_LIST &CLEN.A5
-RUN
-SET &LEN=&CLEN * 20;
-READ CAR_LIST &CLEN.A5. &CARLIST.A&LEN.EVAL.
-SET &CARLIST=TRIM('T', RJUST(200, &CARLIST, 'A200'), 200, ',', 1, 'A200');
-TYPE &CARLIST
Thank you very much, I used variable loop logic and this did the trick. Good thinking - I will also check out the second method without loop. Much appreciated!
WF 8.2
Posts: 22 | Location: US | Registered: September 28, 2017
I tried the 'without a loop' code this morning and am having some issues. So, there are only 21 cars in the car table (MT)this morning and the code is failing on the -READ CAR_LIST &CLEN.A5 line
this runs through the table file hold across cars just fine and fails for 'unrecocgnized format of amper variable -READ CAR_LIST &CLEN.A5 &CARLIST.A&LEN.EVAL.
MT is the file holding the car list, and the car field is A14.
DEFINE FILE MT QCAR/A20='''' || CAR || ''','; END
TABLE FILE MT SUM CNT.CAR SUM QCAR ACROSS CAR ON TABLE SET HOLDLIST PRINTONLY ON TABLE SAVE AS CAR_LIST END
A slightly more compact no-loop method by relying upon the Title values within a COMT file (comma delimited with titles).
Because this only reads the first line, removes spaces and truncates the result, we can set the length of read to be ([length of CAR field + 2] * number of output records) - 1 and not have to bother with getting the count from within the table request.
-DEFAULTH &CARLIST = ''
TABLE FILE CAR
SUM COMPUTE BLNK/A1 = ''; AS ''
ACROSS CAR
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS CAR_LIST FORMAT COMT
END
-RUN
-SET &LEN=(&RECORDS * 22)-1;
-READ CAR_LIST &CARLIST.A&LEN.EVAL.
-SET &CARLIST=STRREP(&CARLIST.LENGTH, &CARLIST.QUOTEDSTRING, 1, ' ', 0, 'x', &CARLIST.LENGTH, 'A&CARLIST.LENGTH');
-SET &CARLIST=TRUNCATE(&CARLIST);
-TYPE &CARLIST
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
I tried to use SUM CAR ACROSS CAR and then grab the second line in the output COMT or the first line in a COM (as it would already be the exact variable this needs) but didn't give too much effort into it
Seasons greetings to you and the team in Israel
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004