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.
I am realatively new to the WebFOCUS language and programming in general. In an effort to streamline the Serial Numbers SUBFOOT of a Parts List report that may become too congested on certain records because of multiple(hundreds) child instances, I need suggestions on how to isolate contiguous, sequential runs such to create a display similar to below…
…here is my Current Output Display… PART Serial Num Prefix Suffix ---- ---------- ------ ------ 300003 BM001 BM 001 BM002 BM 002 BM003 BM 003 BM004 BM 004 MM010 MM 010 MB020 MB 020 ZZ008 ZZ 008 ZZ009 ZZ 009 ZZ010 ZZ 010 Serial Numbers Subfoot : BM001, BM002, BM003, BM004, MM010, MB020, ZZ008, ZZ009, ZZ010
…Desired Output Display… PART Serial Num Prefix Suffix ---- ---------- ------ ------ 300003 BM001 BM 001 BM002 BM 002 BM003 BM 003 BM004 BM 004 MM010 MM 010 MB020 MB 020 ZZ008 ZZ 008 ZZ009 ZZ 009 ZZ010 ZZ 010 Serial Numbers Streamlined-Subfoot : BM001-004, MM010, MB020, ZZ008-010
My concern is with the SUBFOOT section…how can I isolate the MIN and MAX values for contiguous, sequential serial number runs encountered for a given Part Number such to display “BM001-004,…” rather than “BM001, BM003, BM002, BM004,…”?? Any help is greatly appreciated.
Respectfully,This message has been edited. Last edited by: VictoryKPrider,
Posts: 2 | Location: Grand Prairie, TX | Registered: September 20, 2006
Well, it's cumbersome and messy...I'm sure there must be a more efficient way to accomplish this, indeed I've compiled a solution that integrates well within my objective source. Below is my example utilizing the CAR scheme.
-SET &ECHO = ALL;
-*
DEFINE FILE CAR
-* //Preliminarily, set up the data to be utilized.
PARTNUM/A16 WITH CAR = IF CAR EQ 'ALFA ROMEO' THEN '100001'
ELSE IF CAR EQ 'AUDI' THEN '200002'
ELSE IF CAR EQ 'BMW' THEN '300003'
ELSE IF CAR EQ 'DATSUN' THEN '400004'
ELSE IF CAR EQ 'JAGUAR' THEN '500005'
ELSE IF CAR EQ 'JENSEN' THEN '600006'
ELSE IF CAR EQ 'MASERATI' THEN '700007'
ELSE IF CAR EQ 'PEUGEOT' THEN '800008'
ELSE IF CAR EQ 'TOYOTA' THEN '900009'
ELSE IF CAR EQ 'TRIUMPH' THEN '990010';
SER_NUM/A24 WITH MODEL = IF MODEL CONTAINS '2000 4 DOOR BERLINA' THEN 'C3'
ELSE IF MODEL EQ '2000 GT VELOCE' THEN 'C2'
ELSE IF MODEL EQ '2000 SPIDER VELOCE' THEN 'C5'
ELSE IF MODEL EQ '100 LS 2 DOOR AUTO' THEN 'K111'
ELSE IF MODEL EQ '2002 2 DOOR' THEN 'BM001'
ELSE IF MODEL EQ '2002 2 DOOR AUTO' THEN 'BM004'
ELSE IF MODEL EQ '3.0 SI 4 DOOR' THEN 'BM002'
ELSE IF MODEL EQ '3.0 SI 4 DOOR AUTO' THEN 'BM003'
ELSE IF MODEL EQ '530I 4 DOOR' THEN 'MM010'
ELSE IF MODEL EQ '530I 4 DOOR AUTO' THEN 'BM008'
ELSE IF MODEL EQ 'B210 2 DOOR AUTO' THEN 'D6'
ELSE IF MODEL EQ 'V12XKE AUTO' THEN 'JAG1'
ELSE IF MODEL EQ 'XJ12L AUTO' THEN 'JAG2'
ELSE IF MODEL EQ 'INTERCEPTOR III' THEN ''
ELSE IF MODEL EQ 'DORA 2 DOOR' THEN 'MZ101'
ELSE IF MODEL EQ '504 4 DOOR' THEN 'PU9'
ELSE IF MODEL EQ 'COROLLA 4 DOOR DIX AUTO' THEN 'TOY2'
ELSE IF MODEL EQ 'TR7' THEN 'T-7';
-* //First, find the first position of a number in the string.
NUM_STARTPOS/I3 = CHKFMT(24, SER_NUM, 'AAAAAAAAAAAAAAAAAAAAAAAA', NUM_STARTPOS) ;
-* //...get (prefix) alpha string
ALPHA_STRING/A24 = SUBSTR(24, SER_NUM, 1, (NUM_STARTPOS - 1), 24, ALPHA_STRING);
-* //Next, extract the portion of the string that begins with numbers.
NUM_STRING/A24 = SUBSTR(24, SER_NUM, NUM_STARTPOS, 24, 24, NUM_STRING);
-* //...convert the numeric SUBstring to numeric in order to conduct calculations.
SN_N/I4 = EDIT(NUM_STRING);
-* //OPTIONAL; Establish a record-index to preserve order of incoming records, otherwise
-* use BY verb to order record.
RIDX/I5 = IF RIDX LT 1 THEN 1 ELSE RIDX + 1;
END
-*----------------------
TABLE FILE CAR
PRINT
SER_NUM AS 'Serial Num'
-* //Establish a marker to indicate the first instance in a possible run.
COMPUTE IS_FIRST/A1 = IF (PARTNUM NE LAST PARTNUM)
OR (ALPHA_STRING NE LAST ALPHA_STRING)
OR (SN_N NE LAST SN_N + 1)
THEN 'F' ELSE ''; AS 'Is 1st RD inRun?'
ALPHA_STRING AS 'Prefix'
NUM_STRING AS 'Suffix'
BY PARTNUM AS 'PART'
BY SN_N
-*----------------------
ON TABLE HOLD AS CAR1
END
-*-EXIT
-*----------------------------------------------
-*----------------------------------------------
TABLE FILE CAR1
PRINT
SER_NUM AS 'Serial Num'
IS_FIRST
-* //Establish a marker to indicate the first instance of the LAST member in a possible run.
-* //NOTE: Since the COMPUTE takes place AFTER ordering, the records are essentially flipped
-* //upside-down using the BY HIGHEST, and the logic is repeated, calculating in reverse.
COMPUTE IS_LAST/A1 = IF (PARTNUM NE LAST PARTNUM)
OR (ALPHA_STRING NE LAST ALPHA_STRING)
OR (SN_N NE LAST SN_N - 1)
THEN 'L' ELSE ''; AS 'Is Lst RD inRun?'
ALPHA_STRING AS 'Prefix'
NUM_STRING AS 'Suffix'
BY PARTNUM AS 'PART'
-* //...this BY HIGHEST verb-clause flips the records in reverse to
-* //accomodate the IS_LAST computation.
BY HIGHEST NUM_STRING NOPRINT
-*----------------------
ON TABLE HOLD AS CAR2
END
-*-EXIT
-*----------------------------------------------
-*----------------------------------------------
DEFINE FILE CAR2
-* //...establish a concatenation indicator...
DASH/A4 = 'thru';
END
-*----------------------
TABLE FILE CAR2
PRINT
SER_NUM AS 'Serial Num'
ALPHA_STRING AS 'Prefix'
NUM_STRING AS 'Suffix'
IS_FIRST AS 'Is 1st RD inString?'
IS_LAST AS 'Is Last RD inString?'
-* //This COMPUTE defines a single column to mark each record as
-* //...First in run(F), Last in run(L), Middle of run(M), 'no serial number'(>)
-* //...or stand-alone instances(.)...
COMPUTE IS_1ST_LST/A1 = IF (IS_FIRST EQ 'F') AND (IS_LAST EQ '') THEN 'F'
ELSE IF (IS_LAST EQ 'L') AND (IS_FIRST EQ '') THEN 'L'
ELSE IF (IS_FIRST EQ '' AND IS_LAST EQ '') THEN 'M'
ELSE IF SER_NUM EQ '' THEN '>'
ELSE '.'; AS 'RD SeqRunPos inString?';
-* //This COMPUTE preserves stand-alone and no-serial-number records,
-* //...concatenates the DASH delimiter to the Last-in-run SerialNumber suffix where runs are present.
COMPUTE INSTR_CNCAT/A28 = IF ((IS_1ST_LST EQ 'F') OR (IS_1ST_LST EQ '.')) THEN SER_NUM
-* //...this forces the preservation of only the First instance...
ELSE IF IS_1ST_LST EQ 'M' THEN LAST INSTR_CNCAT
-* //...this concatenates the final instance in the run to the DASH.
ELSE IF IS_1ST_LST EQ 'L' THEN ( DASH || NUM_STRING)
ELSE SER_NUM;
-* //This COMPUTE establishes a preliminary SerialNumber string, such to establish
-* // each run to a single record, MARK all remaining in the run to later be eliminated,
-* //an preserve all other stand-alone and no-SerialNumber instances.
COMPUTE PRELIM_SN/A60 = IF INSTR_CNCAT CONTAINS 'thru' THEN (LAST INSTR_CNCAT || INSTR_CNCAT)
ELSE IF IS_1ST_LST EQ '.' THEN SER_NUM
ELSE IF IS_1ST_LST EQ '>' THEN ''
ELSE 'STRIKE';
-* //...the following BY verb-clauses flip the records right-side-up again.
BY
PARTNUM
BY
NUM_STRING NOPRINT
-* //This WHERE TOTAL clause eliminates leftover
-* //records MARKed with the 'STRIKE' indicator.
WHERE TOTAL PRELIM_SN NE 'STRIKE';
-*----------------------
ON TABLE HOLD AS CAR3
END
-*-EXIT
-*----------------------------------------------
-*----------------------------------------------
DEFINE FILE CAR3
-* //...provide a delimiter to seperate serial number elements.
COMA/A2 = ', ';
-* //This defines a final field to house the entire array of SerialNumber members associated
-* //to a Part by concatenating all the members together, delimited by the COMA.
RD_CONCAT/A4000V = IF ((PARTNUM NE LAST PARTNUM)) THEN PRELIM_SN
ELSE IF ((PARTNUM EQ LAST PARTNUM)) THEN (RD_CONCAT || COMA | PRELIM_SN)
ELSE PRELIM_SN;
END
-*----------------------
TABLE FILE CAR3
PRINT
PRELIM_SN AS 'Serial Num'
-* //..OPTIONAL trimming if used in PDF
COMPUTE RD_TRM/A4000V = TRIM('B', RD_CONCAT, 4000, ' ', 4000, 'A4000');
-* //...compute the length of each resultant, trimmed concatenation...
COMPUTE CONCAT_LENGTH/I4 = ARGLEN(50, RD_TRM, CONCAT_LENGTH);
BY
PARTNUM
-*----------------------
ON TABLE HOLD AS CAR4
END
-*-EXIT
-*----------------------------------------------
-*----------------------------------------------
-* //This final step SUMS by CONCAT_LENGTH, leaving only the most comprehensive record
-* //where multiple-member Part-records still remain.
TABLE FILE CAR4
SUM
CONCAT_LENGTH NOPRINT
BY
PARTNUM
-*----------------------
HEADING
"Moch-up PARTS LIST"
""
""
FOOTING BOTTOM
"This is a footing!!!"
""
-*
ON PARTNUM SUBFOOT
""
" SerialNum SubFOOT:"
" <RD_TRM"
""
WHEN RD_TRM NE '';
-*
ON PARTNUM SUBFOOT
""
WHEN RD_TRM EQ '';
-*
ON TABLE SET ONLINE-FMT PDF
END
-EXIT
-*///////////////////////////////////////////////
-***********************************************
-*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Any constructive suggestions on how to more efficiently produce this result, will be appreciated. I hope that this may in some manner spark ideas or help another with a similar issue.
Regards, VictoryKPriderThis message has been edited. Last edited by: VictoryKPrider,
Posts: 2 | Location: Grand Prairie, TX | Registered: September 20, 2006