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.
please use to code tag when posting sample code and/or data/layout. It's the last icon on the ribbon that look like the below
</>
I am not sure to 100% understand your request. bill_01, bill_02 and bill_03 are field name and 100, 113, 120, ... are possible value within each field ?
Then you want to have the each field name to become one unique column and display their respective value beside ?
-*-* Originally, COUNTRY and CAR are distinct columns, they now become one unique column named FLD1
TABLE FILE CAR
BY CAR/A20 AS 'FLD1'
BY MODEL AS 'FLD2'
WHERE COUNTRY EQ 'ENGLAND'
ON TABLE HOLD AS FILE1
END
-RUN
TABLE FILE CAR
BY COUNTRY/A20 AS 'FLD1'
BY MODEL AS 'FLD2'
WHERE COUNTRY EQ 'ITALY'
ON TABLE HOLD AS FILE2
END
-RUN
TABLE FILE FILE1
BY FLD1
BY FLD2
ON TABLE HOLD AS FINALFILE
MORE
FILE FILE2
END
-RUN
TABLE FILE FINALFILE
BY FLD1
BY FLD2
ON TABLE SET BYDISPLAY ON
END
-RUN
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
FLD1 FLD2
ITALY 2000 4 DOOR BERLINA
ITALY 2000 GT VELOCE
ITALY 2000 SPIDER VELOCE
ITALY DORA 2 DOOR
JAGUAR V12XKE AUTO
JAGUAR XJ12L AUTO
JENSEN INTERCEPTOR III
TRIUMPH TR7
this close to what I want, but not exactly. If using Car as example it should be something like this:
FLD1 FLD2
COUNTRY ITALY
COUNTRY ITALY
COUNTRY ITALY
COUNTRY ITALY
MODEL 2000 4 DOOR BERLINA
MODEL 2000 GT VELOCE
MODEL 2000 SPIDER VELOCE
MODEL DORA 2 DOOR
TABLE FILE CAR
BY TOTAL COMPUTE FLD1 /A10 = 'COUNTRY';
BY COUNTRY/A20 AS 'FLD2'
ON TABLE HOLD AS FILE1
END
-RUN
TABLE FILE CAR
BY TOTAL COMPUTE FLD1 /A10 = 'MODEL';
BY MODEL/A20 AS 'FLD2'
ON TABLE HOLD AS FILE2
END
-RUN
TABLE FILE FILE1
BY FLD1
BY FLD2
ON TABLE HOLD AS FINALFILE
MORE
FILE FILE2
END
-RUN
TABLE FILE FINALFILE
BY FLD1
BY FLD2
ON TABLE SET BYDISPLAY ON
END
-RUN
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
SET PAGE=NOLEAD
FILEDEF data DISK baseapp/data.txt
TABLE FILE CAR
PRINT COUNTRY IN 0
OVER CAR IN 0
OVER MODEL IN 0
HEADING
" "
WHEN 1=0
ON TABLE HOLD AS data FORMAT WP
END
This message has been edited. Last edited by: dbeagan,
WebFOCUS 8.2.06
Posts: 210 | Location: Sterling Heights, Michigan | Registered: October 19, 2010
FLD1 FLD2
COUNTRY ENGLAND
COUNTRY FRANCE
COUNTRY ITALY
COUNTRY JAPAN
COUNTRY W GERMANY
MODEL 100 LS 2 DOOR AUTO
MODEL 2000 4 DOOR BERLINA
MODEL 2000 GT VELOCE
MODEL 2000 SPIDER VELOCE
MODEL 2002 2 DOOR
MODEL 2002 2 DOOR AUTO
MODEL 3.0 SI 4 DOOR
MODEL 3.0 SI 4 DOOR AUTO
MODEL 504 4 DOOR
MODEL 530I 4 DOOR
MODEL 530I 4 DOOR AUTO
MODEL B210 2 DOOR AUTO
MODEL COROLLA 4 DOOR DIX A
MODEL DORA 2 DOOR
MODEL INTERCEPTOR III
MODEL TR7
MODEL V12XKE AUTO
MODEL XJ12L AUTO
As notice COUNTRY is not repeat. I want it can be repeat, which I see
ON TABLE SET BYDISPLAY ON
but seem BYDISPLAY ON is not working.
Hi dbeagan,
I try your code, it is close to what I want as well, but the result is all in one column.
FLD1 FLD2 COUNTRY ENGLAND COUNTRY FRANCE COUNTRY ITALY COUNTRY JAPAN COUNTRY W GERMANY MODEL 100 LS 2 DOOR AUTO MODEL 2000 4 DOOR BERLINA MODEL 2000 GT VELOCE MODEL 2000 SPIDER VELOCE MODEL 2002 2 DOOR MODEL 2002 2 DOOR AUTO MODEL 3.0 SI 4 DOOR MODEL 3.0 SI 4 DOOR AUTO MODEL 504 4 DOOR MODEL 530I 4 DOOR MODEL 530I 4 DOOR AUTO MODEL B210 2 DOOR AUTO MODEL COROLLA 4 DOOR DIX A MODEL DORA 2 DOOR MODEL INTERCEPTOR III MODEL TR7 MODEL V12XKE AUTO MODEL XJ12L AUTO
As notice COUNTRY is not repeat. I want it can be repeat, which I see ON TABLE SET BYDISPLAY ON but seem BYDISPLAY ON is not working.
SET BYDISPLAY ON is to "avoid" the masking (non-display) of a repeated BY value. So, yes it does work. Remove it and you will see the difference
What you want is to have as many time a model exist for a country, the same number of time the country displayed ? In other words, if there is 4 models for Italy, you want Italy displayed 4 times ?
What is the purpose of this ? It may help us to understand what you are trying to accomplish
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
SET BYDISPLAY ON is to "avoid" the masking (non-display) of a repeated BY value. So, yes it does work. Remove it and you will see the difference
I remove this line, and the result is no different with it on. wander if something have to do with WebFOCUS version? (the version that I tested was on 8.206)
quote:
What you want is to have as many time a model exist for a country, the same number of time the country displayed ? In other words, if there is 4 models for Italy, you want Italy displayed 4 times ?
As you can see my first example would be base on a bill table. The original table was several bill on easch column( Bill_1, Bill_2, Bill_3 and so on), and my objective is to get those column value turn into single column, but in order to know each value is belong to which Bill, will need to DEFINE another field to display what this bill was belong to. but some of Bill's value may repeated, so need to list every single field. hope this help.This message has been edited. Last edited by: nox,
-REPEAT #NOX FOR &I FROM 1 TO 3;
-SET &HTYPE=IF &I EQ 1 THEN 'HOLD FORMAT ALPHA' ELSE SAVE;
DEFINE FILE nox
BILL_LIST/A8='BILL_0&I';
BILL/I3=BILL_0&I;
END
-*
END
TABLE FILE NOX
BY BILL_LIST
BY BILL
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE &HTYPE
END
-RUN
FILEDEF HOLD DISK HOLD.FTM (APPEND
-#NOX
-*
TABLE FILE HOLD
PRINT BILL
BY BILL_LIST
END
If you have more than 3 columns of bill change the "to" value in the -REPEAT statement.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
I try your code, it is close to what I want as well, but the result is all in one column.
You could use the code to make columns like this:
SET PAGE=NOLEAD
FILEDEF data2 DISK data2.txt
FILEDEF master DISK data2.mas
TABLE FILE CAR
PRINT COUNTRY IN 0
OVER CAR IN 0
OVER LENGTH IN 0
HEADING
" "
WHEN 1=0
ON TABLE HOLD AS data2 FORMAT WP
END
-RUN
-WRITE master FILENAME=DATA2, SUFFIX=FIX, IOTYPE=STREAM, DATASET=data2.txt,$
-WRITE master SEGMENT=DATA2, SEGTYPE=S0, $
-WRITE master FIELDNAME=Blank, ALIAS=E01, USAGE=A01, ACTUAL=A01, $
-WRITE master FIELDNAME=Field, ALIAS=E02, USAGE=A07, ACTUAL=A07, $
-WRITE master FIELDNAME=Value, ALIAS=E03, USAGE=A26, ACTUAL=A26, $
TABLE FILE data2
PRINT Field Value
END
WebFOCUS 8.2.06
Posts: 210 | Location: Sterling Heights, Michigan | Registered: October 19, 2010
Sorry for my late reply, I end up using dbeagan's first example to save 'data' as .csv, then manually create another synonym of that data.csv. After using TOKEN function to split the column into 2 new defined fields. Thank you all for your ideas!
Hi Nox, Pardon my being intrusive, but I think that your solution, coding a MASTER manually, defeats the purpose of WebFOCUS's power. See a slight modification of the code I suggested:
-REPEAT #NOX FOR &I FROM 1 TO 3;
-SET &HTYPE=IF &I EQ 1 THEN 'HOLD FORMAT ALPHA' ELSE SAVE;
-SET &BILL_TYPE=DECODE &I(1 Electric_bill 2 Water_bill 3 Telephone_bill);
-* more values if necessary
DEFINE FILE nox
BILL_LIST/A20='&BILL_TYPE';
BILL/I3=&BILL_TYPE;
END
-*
END
TABLE FILE NOX
BY BILL_LIST
BY BILL
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE &HTYPE
END
-RUN
FILEDEF HOLD DISK HOLD.FTM (APPEND
-#NOX
-*
TABLE FILE HOLD
PRINT BILL
BY BILL_LIST
END
As you prefer...
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006