[SOLVED] Extracting portions of a long user input field into several subfields
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.
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.
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:
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.
-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
April 23, 2009, 04:09 PM
ta2007
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:
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
April 24, 2009, 04:54 AM
Kofi
I pleased to help, this good Forum.
Kofi
Client Server 8.1.05: Apache; Tomcat;Windows Server 2012 Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012