Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Closed]Populate listbox vertically
Go
New
Search
Notify
Tools
Reply
  
[Closed]Populate listbox vertically
 Login/Join
 
Gold member
posted
Hi,

I use the following code to read values from text file and trying to populate them to the listbox. The values are getting added but horizontally as a single value. I need them to be displayed vertically as multiple values.

animals.txt contains the following value
Lion
Tiger
Elephant

--- My Code ----------------------------

SET HOLDLIST=PRINTONLY
FILEDEF TRY DISK ab63221/animals.txt
TABLE FILE TRY
PRINT ANIMAL
ON TABLE SAVE AS ANIMALLIST
END
-RUN


-HTMLFORM BEGIN

Have rest of my HTML code which is not getting displayed in this post

!IBI.FIL.ANIMALLIST;

-HTMLFORM END
----------------------------------------------------------

Thanks,
Ramya
Webfocus 8105, HTML, Javascript

This message has been edited. Last edited by: Ramya,
 
Posts: 73 | Registered: January 02, 2012Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Ramya,

This very basic know of HTML, Perhaps HTML help might be your wanting?

W3Schools HTML

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
 
Posts: 103 | Registered: April 06, 2009Reply With QuoteReport This Post
Master
posted Hide Post
Here is an example with the CAR file:

TABLE FILE IBISAMP/CAR
PRINT
    CAR
WHERE RECORDLIMIT EQ 3
ON TABLE HOLD AS CARJSON FORMAT JSON
END

-HTMLFORM BEGIN
<script type="text/javascript">
function build_listbox() {
	var cars = !IBI.FIL.CARJSON;

// "cars" variable now contains this JSON object:
//
//   {
//     "records" : [
//        { "CAR" : "JAGUAR" },
//        { "CAR" : "JENSEN" },
//        { "CAR" : "TRIUMPH" }
//      ]
//   }

	var listbox = document.getElementById("listbox1");

	for (i = 0; i < cars.records.length; i++) {
		var option = document.createElement("option");
		option.text = cars.records[i].CAR;
		option.value = cars.records[i].CAR;
		listbox.add(option);
	}
}
</script>
<body onload="build_listbox()">
<select id="listbox1"></select>
</body>
-HTMLFORM END


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
You probably need to account for the CR/LF in the text file before loading it...
 
Posts: 3043 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
Thanks All,

I got it done. Simple things never strike when we are into the work.

Regards,
Ramya
Webfocus 8105
HTML,Javascript


WebFocus 7702
HTML
 
Posts: 73 | Registered: January 02, 2012Reply With QuoteReport This Post
Expert
posted Hide Post
So, What's was your solution, the "Simple things never strike when we are into the work."?
 
Posts: 3043 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
Doug,

I have used Squatch's method for displaying them vertically

Thanks,
Ramya
WebFocus 8105,HTML,Javascript
 
Posts: 73 | Registered: January 02, 2012Reply With QuoteReport This Post
Expert
posted Hide Post
Thanks for you feedback Ramya...
 
Posts: 3043 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [Closed]Populate listbox vertically

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.