Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Extracting portions of a long user input field into several subfields

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Extracting portions of a long user input field into several subfields
 Login/Join
 
Member
posted
I have a report requirement to display the names of 'reps' selected by the user on the launch page in the report header page the report. The rep data comes from the launch page as a single text string that is assigned to an &var, with user values separated by comma, space.

Ex. 'BURGER_A, BURNETTE_A, FLOGHBAER_B, TERRENCE_H, PRATT_K, WHITNEY_K, MINOURE_M, RUTGERS_M, JEFFERSON_R, WHITMORE_S, BULLHOUSE_S, DEGRASSE_T, ADAMS_V'

However, this is a dynamic field and the number of reps can change.

Right now, the field does not wrap in the heading and any parts of the field in excess of the display area 'fall off' the right side of the report. I need to develop dynamic code that will create an appropriate number of headings and place portions of the values into them for use in the build of the header section.

I can fit approximately 64 characters on the screen.

Ex:

REP_HDR_1 = 'BURGER_A, BURNETTE_A, FLOGHBAER_B, TERRENCE_H, PRATT_K,'
REP_HDR_2 = 'WHITNEY_K, MINOURE_M, RUTGERS_M, JEFFERSON_R, WHITMORE_S, BULLHOUSE_S,'
REP_HDR_3 = 'DEGRASSE_T, ADAMS_V'

Any ideas out there on how to loop this to get this output?

Thanks.

This message has been edited. Last edited by: Kerry,


7.6.4
XP SP3
EXL2K, HTML, PDF
 
Posts: 26 | Location: Ohio | Registered: April 13, 2009Report This Post
Expert
posted Hide Post
Look up the PARAG subroutine.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Member
posted Hide Post
I'm new to Web Focus, so I am probably not quite putting this together right. I have been trying to process the parag part in the set area. Closest I've gotten is the code below, but I can't figure out how to initialize a &var with a variable length of text. I tried initializing with with spaces or letters, but the extra characters appear as filler in the final cell. Also, When I tried to append a title for the actual header display in the second loop, the first line truncated. Copy code below into a blank report based off CAR to see what is happening:

-DEFAULT &SREP = 'BURGER_A, BURNETTE_A, FLOGHBAER_B, TERRENCE_H, PRATT_K, WHITNEY_K, MINOURE_M, RUTGERS_M, JEFFERSON_R, WHITMORE_S, BULLHOUSE_S, DEGRASSE_T, ADAMS_V';

-SET &SREP_CHAR_CNT = &SREP.LENGTH;
-SET &DISPL_LEN = 64;
-SET &SREPP = 'intitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitialize';
-SET &SREPP = PARAG(&SREP.LENGTH, &SREP, '~', &DISPL_LEN, &SREPP);
-SET &DISPL_ROWS = (&SREP_CHAR_CNT+(&DISPL_LEN-1))/&DISPL_LEN;

-SET &COUNTERA=1;
-REPEAT LOOP1 FOR &COUNTERA FROM 1 TO &DISPL_ROWS STEP 1;
-SET &SREP_HDR.&COUNTERA='intitializeintitializeintitializeintitializeintitializeintitializeintitialize';
-SET &SREP_HDR.&COUNTERA=GETTOK(&SREPP, &SREPP.LENGTH, &COUNTERA, '~', &SREPP.LENGTH, &SREP_HDR.&COUNTERA);
-LOOP1

-SET &COUNTERB=1;
-REPEAT LOOP2 FOR &COUNTERB FROM 1 TO &DISPL_ROWS STEP 1;
-SET &SVC_REP_HDR.&COUNTERB = 'intitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitializeintitialize';
-SET &SVC_REP_HDR.&COUNTERB=IF &COUNTERB EQ 1 THEN 'Service Rep(s): ' | &SREP_HDR.&COUNTERB ELSE &SREP_HDR.&COUNTERB ;
-LOOP2
-? &
-EXIT

How do I use parag and set statements properly to get just the actual output?

Thanks.


7.6.4
XP SP3
EXL2K, HTML, PDF
 
Posts: 26 | Location: Ohio | Registered: April 13, 2009Report This Post
<JG>
posted
Very good attempt.

1. no need to initialize the variables.
2. when using sub-routines in DM you must use a format not a variable name.

look at this

 
-DEFAULT &SREP = 'BURGER_A, BURNETTE_A, FLOGHBAER_B, TERRENCE_H, PRATT_K, WHITNEY_K, MINOURE_M, RUTGERS_M, JEFFERSON_R, WHITMORE_S, BULLHOUSE_S, DEGRASSE_T, ADAMS_V';

-SET &SREP_CHAR_CNT = &SREP.LENGTH;
-SET &DISPL_LEN = 64;
-SET &SREPP = ' ';
-SET &SREPP = PARAG(&SREP.LENGTH, &SREP, '~', &DISPL_LEN, 'A&SREP.LENGTH');
-SET &DISPL_ROWS = (&SREP_CHAR_CNT+(&DISPL_LEN-1))/&DISPL_LEN;

-SET &COUNTERA=1;
-REPEAT LOOP1 FOR &COUNTERA FROM 1 TO &DISPL_ROWS STEP 1;
-SET &SREP_HDR.&COUNTERA=' ';
-SET &SREP_HDR.&COUNTERA=GETTOK(&SREPP, &SREPP.LENGTH, &COUNTERA, '~', &SREPP.LENGTH, 'A64');
-LOOP1

-SET &COUNTERB=1;
-REPEAT LOOP2 FOR &COUNTERB FROM 1 TO &DISPL_ROWS STEP 1;
-SET &SVC_REP_HDR.&COUNTERB = ' ';
-SET &SVC_REP_HDR.&COUNTERB=IF &COUNTERB EQ 1 THEN 'SERVICE REP(S): ' | &SREP_HDR.&COUNTERB ELSE &SREP_HDR.&COUNTERB ;
-LOOP2
-TYPE &SVC_REP_HDR1
-EXIT
 
 
Report This Post
Expert
posted Hide Post
You could simplify this to:
-DEFAULT &SREP = 'BURGER_A, BURNETTE_A, FLOGHBAER_B, TERRENCE_H, PRATT_K, WHITNEY_K, MINOURE_M, RUTGERS_M, JEFFERSON_R, WHITMORE_S, BULLHOUSE_S, DEGRASSE_T, ADAMS_V';

-SET &SREP_CHAR_CNT = &SREP.LENGTH;
-SET &DISPL_LEN = 64;
-SET &SREPP = ' ';
-SET &SREPP = PARAG(&SREP.LENGTH, &SREP, '~', &DISPL_LEN, 'A&SREP.LENGTH');
-SET &DISPL_ROWS = (&SREP_CHAR_CNT+(&DISPL_LEN-1))/&DISPL_LEN;

-REPEAT LOOP1 FOR &COUNTERA FROM 1 TO &DISPL_ROWS STEP 1;
-SET &SREP_HDR.&COUNTERA=' ';
-SET &TEMP = GETTOK(&SREPP, &SREPP.LENGTH, &COUNTERA, '~', &SREPP.LENGTH, 'A64');
-SET &SREP_HDR.&COUNTERA=IF &COUNTERA EQ 1 THEN 'SERVICE REP(S): ' | &TEMP ELSE &TEMP ;
-TYPE &SREP_HDR.&COUNTERA
-LOOP1

-EXIT


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
Thanks all. The tips given by JG and WAZ helped clear up the initial issue of parsing; I am getting the right number of dynamic placeholders and the text is going in right.

This is a spinoff question: How do I get these objects, which are created on the fly, to be placed in the heading section? Can you create loops within the ON TABLE PAGE-BREAK section (the actual report header)? I tried to create a loop within this area to call/create "&SREP_HDR.&COUNTERA ", but it did not like my attempts.


7.6.4
XP SP3
EXL2K, HTML, PDF
 
Posts: 26 | Location: Ohio | Registered: April 13, 2009Report This Post
Platinum Member
posted Hide Post
You put loop inside HEADING -

HEADING
" This is haeding <+0> &DATEDTMYY"
-DEFAULT &SREP = 'BURGER_A, BURNETTE_A, FLOGHBAER_B, TERRENCE_H, PRATT_K, WHITNEY_K, MINOURE_M, RUTGERS_M, JEFFERSON_R, WHITMORE_S, BULLHOUSE_S, DEGRASSE_T, ADAMS_V';

-SET &SREP_CHAR_CNT = &SREP.LENGTH;
-SET &DISPL_LEN = 64;
-SET &SREPP = ' ';
-SET &SREPP = PARAG(&SREP.LENGTH, &SREP, '~', &DISPL_LEN, 'A&SREP.LENGTH');
-SET &DISPL_ROWS = (&SREP_CHAR_CNT+(&DISPL_LEN-1))/&DISPL_LEN;

-REPEAT LOOP1 FOR &COUNTERA FROM 1 TO &DISPL_ROWS STEP 1;
-SET &SREP_HDR.&COUNTERA=' ';
-SET &TEMP = GETTOK(&SREPP, &SREPP.LENGTH, &COUNTERA, '~', &SREPP.LENGTH, 'A64');
-SET &SREP_HDR.&COUNTERA=IF &COUNTERA EQ 1 THEN 'SERVICE REP(S): ' | &TEMP ELSE &TEMP ;
-TYPE "&SREP_HDR.&COUNTERA"
-LOOP1
I think this work, no test though Frowner

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
 
Posts: 106 | Registered: April 06, 2009Report This Post
Member
posted Hide Post
Kofi,

Your approach worked. The final code ended up being:

ON TABLE PAGE-BREAK
-SET &SREP_CHAR_CNT = &SREP.LENGTH;
-SET &DISPL_LEN = 64;
-SET &SREPP = ' ';
-SET &SREPP = PARAG(&SREP.LENGTH, &SREP, '~', &DISPL_LEN, 'A&SREP.LENGTH');
-SET &DISPL_ROWS = (&SREP_CHAR_CNT+(&DISPL_LEN-1))/&DISPL_LEN;
-SET &FRMTLEN = 'A' | &DISPL_LEN;

-REPEAT LOOP1 FOR &COUNTERA FROM 1 TO &DISPL_ROWS STEP 1;
-SET &SREP_HDR.&COUNTERA=' ';
-SET &TEMP = GETTOK(&SREPP, &SREPP.LENGTH, &COUNTERA, '~', &SREPP.LENGTH, '&FRMTLEN');
-SET &SREP_HDR.&COUNTERA=IF &COUNTERA EQ 1 THEN 'Service Rep(s): ' | &TEMP ELSE &TEMP ;
"&SREP_HDR.&COUNTERA "
-LOOP1

Thanks All!


7.6.4
XP SP3
EXL2K, HTML, PDF
 
Posts: 26 | Location: Ohio | Registered: April 13, 2009Report This Post
Member
posted Hide Post
One last formatting tip for those using this code...I found it easier to set up any formatting (font, centering, underline, bold, etc) to be used on these rows that were created on the fly in the general category for that area. Since I couldn't predict how many rows would be created, it lets WF have a 'default'. See below:

TYPE=TABHEADING,
OBJECT=TEXT,
JUSTIFY=CENTER,
SIZE=10,
FONT='ARIAL',
$
TYPE=TABHEADING,
LINE=1,
STYLE=BOLD+UNDERLINE,
SIZE=14,
JUSTIFY=CENTER,
$
TYPE=TABHEADING,
LINE=2,
STYLE=BOLD+UNDERLINE,
SIZE=14,
JUSTIFY=CENTER,
$

1st two lines were report headers with their own formatting. Their formatting is specified by Line=1 and Line=2. All of the criteria rows I showed (which came after these two rows and include the ones created on the fly) were formatted based on TABHEADING data.


7.6.4
XP SP3
EXL2K, HTML, PDF
 
Posts: 26 | Location: Ohio | Registered: April 13, 2009Report This Post
Platinum Member
posted Hide Post
I pleased to help, this good Forum. Smiler

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
 
Posts: 106 | Registered: April 06, 2009Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Extracting portions of a long user input field into several subfields

Copyright © 1996-2020 Information Builders