I have a formatting question , I have a series of address fields, Address line 1, address Line 2, address line 3 , city , state and zip. I can concatenate a compute field to properly format the city state and zip as CITY ST, ZZZIP (no problem on this line) but, the way the end user needs the address formatted is so that the fields 1,2 and 3 roll up so that no white space is created. I am trying to this in a PDF header so that I can deliver a nicely formatted report Report regarding Donors at a State University. Sometimes there is a line 2 or 3 , sometimes not but when there is not I would like to eliminate the empty row,
I feel like someone has surely done this before to create labels or letters
ThanksThis message has been edited. Last edited by: Geoff Fish,
Instead of printing address line 2 and 3, define a new line that checks if line 2 and 3 are blank. If they are promote city, state zip up. Something like this: NEW_ADD_2/A30=IF ADDRESS_LINE2 EQ MISSING THEN ADDRESS_LINE3 ELSE ADDRESS_LINE2; NEW_ADD_3/A30=IF ADDRESS_LINE3 EQ MISSING THEN CITY_STATE_ZIP ELSE ADDRESS_LINE3;
WebFOCUS 8206, Unix, Windows
August 03, 2017, 10:05 PM
jfr99
Here's a technique I've been using for a long time ...
You should be able to run this code. It creates two reports. First report just prints the original address lines and the second report prints the new label lines.
-* FILEDEF DATA DISK adr_file.txt -RUN -WRITE DATA Information Builders, Inc| | |Two Penn Plaza|New York, NY 10121-2898 -WRITE DATA Information Builders, Inc|Attn: WebFocus | |Two Penn Plaza|New York, NY 10121-2898 -WRITE DATA ReportCaster|Information Builders, Inc|Marketing Department|Two Penn Plaza|New York, NY 10121-2898 -WRITE DATA Information Builders, Inc| |Two Penn Plaza| |New York, NY 10121-2898 -WRITE DATA InfoAssist| |Two Penn Plaza|New York, NY 10121-2898| -WRITE DATA Information Builders, Inc| |AppStudio|Two Penn Plaza|New York, NY 10121-2898 -WRITE DATA IBI|Two Penn Plaza|New York, NY 10121-2898| | -WRITE DATA JavaScript|CSS|Two Penn Plaza| |New York, NY 10121-2898 -WRITE DATA Information Builders, Inc| |Attn: HTML |Two Penn Plaza|New York, NY 10121-2898 -WRITE DATA | |FocalPoint|Two Penn Plaza|New York, NY 10121-2898 -CLOSE -RUN -* FILEDEF MASTER DISK adr_file.mas -RUN -WRITE MASTER FILENAME=ADR_FILE, SUFFIX=DFIX,$ -WRITE MASTER SEGMENT=ADR_FILE, SEGTYPE=S0,$ -WRITE MASTER FIELDNAME=ADR_L1,,A32,A32,$ -WRITE MASTER FIELDNAME=ADR_L2,,A32,A32,$ -WRITE MASTER FIELDNAME=ADR_L3,,A32,A32,$ -WRITE MASTER FIELDNAME=ADR_L4,,A32,A32,$ -WRITE MASTER FIELDNAME=ADR_L5,,A32,A32,$ -WRITE MASTER FIELDNAME=DELIMITER, ALIAS='|',A01,A01,$ -CLOSE -RUN -* FILEDEF ADR_FILE DISK adr_file.txt -RUN -* DEFINE FILE ADR_FILE CNTR/I7SC = CNTR + 1; -* P_L1/A32 = ADR_L1; P_L2/A32 = ADR_L2; P_L3/A32 = ADR_L3; P_L4/A32 = ADR_L4; P_L5/A32 = ADR_L5; -* P_XL1/A33 = IF P_L1 EQ ' ' THEN ' ' ELSE P_L1 | 'X'; P_XL2/A33 = IF P_L2 EQ ' ' THEN ' ' ELSE P_L2 | 'X'; P_XL3/A33 = IF P_L3 EQ ' ' THEN ' ' ELSE P_L3 | 'X'; P_XL4/A33 = IF P_L4 EQ ' ' THEN ' ' ELSE P_L4 | 'X'; P_XL5/A33 = IF P_L5 EQ ' ' THEN ' ' ELSE P_L5 | 'X'; -* P_ONELINE/A165 = P_XL1 || P_XL2 || P_XL3 || P_XL4 || P_XL5; -* LBL_L1/A32 = SUBSTR(132,P_ONELINE,1,33,32,LBL_L1); LBL_L2/A32 = SUBSTR(132,P_ONELINE,34,66,32,LBL_L2); LBL_L3/A32 = SUBSTR(132,P_ONELINE,67,99,32,LBL_L3); LBL_L4/A32 = SUBSTR(132,P_ONELINE,100,132,32,LBL_L4); LBL_L5/A32 = SUBSTR(198,P_ONELINE,133,165,32,LBL_L5); END -* TABLE FILE ADR_FILE PRINT ADR_L1 ADR_L2 ADR_L3 ADR_L4 ADR_L5 BY CNTR END -* TABLE FILE ADR_FILE PRINT LBL_L1 LBL_L2 LBL_L3 LBL_L4 LBL_L5 BY CNTR END -EXIT
WebFocus 8.201M, Windows, App Studio
August 04, 2017, 12:03 PM
MartinY
I don't know if this can help, but at least it can gives you a starting point to work with. Can also work using SUBHEAD, FOOTING, ... Just need to have as many conditional HEADING as needed.
TABLE FILE PERSINFO
BY PIN NOPRINT
ON PIN PAGE-BREAK
HEADING
"Pin : <PIN"
"Street : <STREETNO"
"Apt : <APT"
"City : <CITY"
"State : <STATE"
WHEN APT GT '';
HEADING
"Pin : <PIN"
"Street : <STREETNO"
"City : <CITY"
"State : <STATE"
WHEN APT EQ '';
ON TABLE PCHOLD FORMAT PDF
END
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
August 07, 2017, 09:46 AM
Dev
Try this......
DEFINE FILE SYSCOLUM
LIN1/A50 = 'ADDRESS LINE 1';
LIN2/A50 = '';
LIN3/A50 = 'LINE 3'
END
TABLE FILE SYSCOLUM
SUM
COMPUTE EEE/A200 = IF LIN1 EQ '' THEN LIN2 | LIN3 ELSE
IF LIN2 EQ '' THEN LIN1 | LIN3 ELSE
IF LIN1 EQ '' AND LIN2 EQ '' THEN LIN3 ELSE
IF LIN1 NE '' AND LIN2 NE '' AND LIN3 NE '' THEN LIN1 | LIN2 | LIN3;
BY TBNAME
WHERE RECORDLIMIT EQ 1
END
8202, 8105M, 7.7.03
August 07, 2017, 09:58 AM
MartinY
quote:
COMPUTE EEE/A200 = IF LIN1 EQ '' THEN LIN2 | LIN3 ELSE IF LIN2 EQ '' THEN LIN1 | LIN3 ELSE IF LIN1 EQ '' AND LIN2 EQ '' THEN LIN3 ELSE IF LIN1 NE '' AND LIN2 NE '' AND LIN3 NE '' THEN LIN1 | LIN2 | LIN3;
Dev,
No need to do all this IF ... THEN ... ELSE. If you would like to have all three lines together without spaces (which I think Geoff is not requesting) you just need to use the double pipe. In below, I kept a space between value and then remove it if no data beside it (--> and <-- are there only to show that starting and ending of the string) :
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
August 07, 2017, 03:30 PM
jgelona
I don't know if it is available on IBI's website or not but it should be. Try to find the FOCUS Systems Journal Encyclopedia Vol 6 Number 2 from 1994. I can't believe I've kept this for over 23 years. Most of this publication was written by Noreen Redden and Art Greenhaus (the original Foc Wizards). It extensively covers the MacGyver Technique (14 articles). I think what is being asked for is covered in the article beginning on page 10.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
August 08, 2017, 06:13 PM
Doug
quote:
Noreen Redden and Art Greenhaus (the original Foc Wizards)
Those manuals are worth their weight in gold... The info still holds true...
In FOCUS Since 1983 ~ from FOCUS to WebFOCUS. Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
August 24, 2017, 04:06 PM
Geoff Fish
Never really understood the Art Greenhas method suggested but did come up with a solution that works.
Any criticisms or suggestions gladly taken into account.
TABLE FILE SQLOUT PRINT COMPUTE CITSTATEZIP/A300 = AWVHHLD_CITY || ( ' ' | AWVHHLD_STAT_CODE ) || ( ', ' | AWVHHLD_ZIP ); NOPRINT COMPUTE BUSCITYZIP/A300 = BUSINESS_CITY || ( ' ' | BUSINESS_STAT_CODE ) || ( ', ' | BUSINESS_ZIP ); NOPRINT COMPUTE PREF_CLASS/A16 = IF AWVHHLD_PREF_CLAS NE '9999' THEN AWVHHLD_PREF_CLAS ELSE ''; NOPRINT COMPUTE CONF/A12 = IF AWVHHLD_CONFID_IND EQ 'Y' THEN 'Confidential' ELSE ' '; NOPRINT HEADING """""" WHEN BUSINESS_STREET_LINE2 NE ' ' AND BUSINESS_STREET_LINE3 NE ' ';
HEADING """"" WHEN BUSINESS_STREET_LINE1 NE ' ' AND BUSINESS_STREET_LINE2 NE ' ' AND BUSINESS_STREET_LINE3 EQ ' ' ;
HEADING """" WHEN BUSINESS_STREET_LINE1 NE ' ' AND BUSINESS_STREET_LINE2 EQ ' ' AND BUSINESS_STREET_LINE3 EQ ' ' ;
HEADING """WHEN BUSINESS_STREET_LINE1 EQ ' ' AND BUSINESS_STREET_LINE2 EQ ' ' AND BUSINESS_STREET_LINE3 EQ ' ' AND BUSINESS_CITY NE ' ' ;
HEADING ""WHEN BUSINESS_STREET_LINE1 EQ ' ' AND BUSINESS_STREET_LINE2 EQ ' ' AND BUSINESS_STREET_LINE3 EQ ' ' ;
ON TABLE SET PAGE-NUM NOLEAD ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT PDF END