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] HOLD 'Formatted' Output For Use In Listbox

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] HOLD 'Formatted' Output For Use In Listbox
 Login/Join
 
Guru
posted
Hi all,

Consider this report output...
TABLE FILE CAR
BY COUNTRY NOPRINT AS ''
BY CAR AS ''
ON COUNTRY SUBHEAD
"---<+0><COUNTRY<+0>---"
ON TABLE SET PAGE-NUM NOLEAD 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
END


Ultimately I want to use this output to populate a listbox. I can't go directly to XML because I'll lose the subhead. Is there some format I can use to HOLD this output exactly as I want it and then output it to XML for my listbox?

Something like...
FILEDEF LSTHLD DISK test/LSTHLD.???
TABLE FILE CAR
BY COUNTRY NOPRINT AS ''
BY CAR AS ''
ON COUNTRY SUBHEAD
"---<+0><COUNTRY<+0>---"
ON TABLE SET PAGE-NUM NOLEAD 
ON TABLE NOTOTAL
ON TABLE HOLD AS LSTHLD FORMAT ????????????
END
-RUN
TABLE FILE LSTHLD
PRINT *
ON TABLE PCHOLD FORMAT XML
END


I can't seem to find the right combination of the file extension in the FILEDEF statement and the format in the HOLD statement.

Thanks in advance for any help!

Dan

This message has been edited. Last edited by: Dan Pinault,


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report This Post
Virtuoso
posted Hide Post
How about creating the subhead (country names) as dummy CARs so you can mix them in the same XML file.
You may need to give these dummy cars a special sequenze to hold it as the first row per country.

what are you going to use the drop down box for?




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Virtuoso
posted Hide Post
I'll go in the same direction as Frank. I might have a quicker answer by asking "What do you need as the contents/purpose of the list box?"
Having a subheading in a list box isn't the norm. Usually contents of a list box are selectable values.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Guru
posted Hide Post
Interesting idea Frank. I tried doing something like
IF (COUNTRY NE LAST COUNTRY)...
but then I lost the first CAR item in the list. I'll have to give the numbering concept some think-time.

The listbox will be on an ad-hoc reporting screen. We want to display a list of fieldnames in the listbox but have them 'grouped' together by the segment name in our business view. The actual code will look more like this...
CHECK FILE CAR HOLD AS CARHLD
TABLE FILE CARHLD
BY SEGNAME NOPRINT
BY FIELDNAME AS ''
ON SEGNAME SUBHEAD
"---<+0><SEGNAME<+0>---"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
END


I just thought it would be simpler to use the COUNTRY and CAR fields for the purpose of this thread.

Cheers!

Dan


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report This Post
Guru
posted Hide Post
quote:
Originally posted by Darin Lee:
Having a subheading in a list box isn't the norm. Usually contents of a list box are selectable values.


I agree Darin but the powers-that-be really want to see the list of selection items 'grouped' in some fashion. If I can get the list to work as shown above then perhaps I'll just add some javascript to not allow selection of the items whose content is like '---%'.

Not sure how else to approach this. I'm open to alternatives if you have any suggestions.

Thanks,

Dan


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report This Post
Virtuoso
posted Hide Post
This has got to be a near the top of my "Ugliest Code" list, but I just couldn't figure out how to get the titles in with the values. Working backwards, the only way was to have them both in the same column, but then they have to be re-sorted in the appropriate order. So here's something with the CAR file. You'll have to adjust the code accordingly to make it into a list box.

-SET &ECHO=ALL;
SET HOLDLIST=PRINTONLY
-*get all the values and assign sort orders for correlation
DEFINE FILE CAR
COUNTER/I9 WITH COUNTRY=COUNTER + 1;
NCOUNTRY/A30='-----'|COUNTRY||'-----';
END
TABLE FILE CAR
PRINT COUNTRY
     NCOUNTRY
     CAR/A30
     COUNTER
BY COUNTRY NOPRINT
BY CAR NOPRINT
ON TABLE HOLD 
END
-*get all the countries wit sort values
TABLE FILE HOLD
SUM NCOUNTRY 
    MAX.COUNTER
	COMPUTE ORDER/I1=0;
	COUNTRY
BY NCOUNTRY NOPRINT
ON TABLE HOLD AS HEADINGS FORMAT FOCUS
END
-*get all the cars with sort values
TABLE FILE HOLD
SUM CAR
	MAX.COUNTER
	COMPUTE ORDER/I1=1;
	COUNTRY
BY NCOUNTRY NOPRINT
BY CAR NOPRINT
ON TABLE HOLD AS DETAILS FORMAT FOCUS
END
-RUN
-*concatentate the hold files
USE 
DETAILS.FOC AS DETAILS
HEADINGS.FOC AS DETAILS
END
-RUN
-*read as a single file and output in sort orders
TABLE FILE DETAILS
PRINT CAR
BY COUNTRY NOPRINT
BY COUNTER NOPRINT
BY ORDER NOPRINT
BY CAR NOPRINT
END


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
Old-fashioned non-XML method, using OPTGROUP:

SET HOLDLIST=PRINTONLY
SET HOLDFORMAT=ALPHA

TABLE FILE CAR
PRINT
COMPUTE OPTGROUP/A100 =
'<optgroup label="' || COUNTRY || '">'; NOPRINT

COMPUTE OPTVAL/A100 =
  '<option value="' || CAR || '">' || CAR || '</option>'; NOPRINT

COMPUTE OPTION/A200 =
IF COUNTRY NE LAST COUNTRY THEN OPTGROUP || OPTVAL ELSE OPTVAL;

BY COUNTRY NOPRINT
BY CAR NOPRINT

ON TABLE HOLD AS HLIST1
END
-RUN

-HTMLFORM BEGIN

<form>
<select>
!IBI.FIL.HLIST1;
</select>
</form>

-HTMLFORM END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
I would stick with the old-fashioned (Francis) as opposed to the uninformed (me) speaking of the code and not the author, of course Wink

Helps to know some more of the HTML tags. OPTGROUP would be the best/easiest way.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
But if Dan really really needs xml output, here's a way to do that:
FILEDEF HOLDCAR DISK HOLDCAR.FTM (APPEND

TABLE FILE CAR
SUM COMPUTE CFIELD/A30 = '------' | COUNTRY || '------';
BY  COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS HOLDCAR
END
TABLE FILE CAR
PRINT COMPUTE CFIELD/A30 = CAR;
BY COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS HOLDCAR
END

TABLE FILE HOLDCAR
PRINT CFIELD
BY COUNTRY NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE PCHOLD FORMAT XML
END


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Guru
posted Hide Post
GENIUS! Thanks GamP!

Yes, I really need XML. I'm trying to stay within the confines of the HTML Composer and add the least amount of extra code possible. This is great! I can use this code within the existing WebFOCUS listbox control.

This has made my day Smiler


7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
 
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007Report 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] HOLD 'Formatted' Output For Use In Listbox

Copyright © 1996-2020 Information Builders