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] WebFOCUS data to jquery

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[solved] WebFOCUS data to jquery
 Login/Join
 
Platinum Member
posted
Hello

I have a form to update a database and everything is working fine. I am trying to update HTML form input elements with data from webfocus.
Can someone please help on this?
TABLE FILE CAR
PRINT
	DST.COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS CNTRY_CAR FORMAT ALPHA
END

-HTMLFORM BEGIN
<HTML>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function()
{
for(var i = 0;i<&LINES;i++)
	{
		$('#cn_table tr').last().after('<tr><TD><input name="CNTRY" size="10"></TD><TD><input id="YR" name="YR" value="!IBI.AMP.DATEYY;" size="5"></TD></tr>');
	}
});
</script>
</HEAD>
<body>
<TABLE id="cn_table">
<TR>
<TD><b>Country</TD>
<TD><b>Year</TD>
</tr>
</TABLE>
</body>
</html>
-HTMLFORM END


Each of the 5 values of field COUNTRY from hold file CNTRY_CAR should get populated in each textbox.
Please suggest.

Thanks

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


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
 
Posts: 139 | Registered: July 21, 2011Report This Post
Gold member
posted Hide Post
Maybe use FORMAT HTMTABLE instead of looping through the values and then submit the form later.


Release: WebFOCUS 8104, AppStudio: 8105
OS: Windows
Output: HTML,Excel,Active Reports
 
Posts: 89 | Registered: November 19, 2013Report This Post
Platinum Member
posted Hide Post
quote:
Originally posted by SSander:
Maybe use FORMAT HTMTABLE instead of looping through the values and then submit the form later.

Hello

I would like to go ahead this way as there is lot of other functionality added to this and I don't want to mess it up. Provided example is a trimmed version


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
 
Posts: 139 | Registered: July 21, 2011Report This Post
Master
posted Hide Post
Whats your end game with this? If all you want is to put an input into the page, you can do that without jquery like this:

TABLE FILE CAR
PRINT
	COMPUTE INPUT_CNTRY/A255V='<input name="CNTRY" size="10" value="' || DST.COUNTRY || '">';AS 'Country'
	COMPUTE INPUT_YR/A255V='<input id="YR" name="YR" value="&DATEYY.EVAL" size="5">'; AS 'Year'
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE PCHOLD FORMAT HTML
END  


You can also add javascript files to the report and call JS functions if needed. Basically any code you would write for HTML can be injected into the report.

I would assume that you have something more in mind though then just using Inputs.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Platinum Member
posted Hide Post
Hello Eric

I need loop iterator to create as many input records as the number of fields from a webfocus table and little more functionality. Everything works as per specifications. Only pending thing is updating the text box with data.
So, I don't want to start a whole new procedure to get everything done again.

quote:
Originally posted by eric.woerle:
Whats your end game with this? If all you want is to put an input into the page, you can do that without jquery like this:

TABLE FILE CAR
PRINT
	COMPUTE INPUT_CNTRY/A255V='<input name="CNTRY" size="10" value="' || DST.COUNTRY || '">';AS 'Country'
	COMPUTE INPUT_YR/A255V='<input id="YR" name="YR" value="&DATEYY.EVAL" size="5">'; AS 'Year'
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE PCHOLD FORMAT HTML
END  


You can also add javascript files to the report and call JS functions if needed. Basically any code you would write for HTML can be injected into the report.

I would assume that you have something more in mind though then just using Inputs.


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
 
Posts: 139 | Registered: July 21, 2011Report This Post
Master
posted Hide Post
Yes, you can pass the results of a TABLE FILE command into a JavaScript for loop construct, with only some minor additions to your code:
-* File Array2JavaScript.fex
APP PREPENDPATH IBISAMP
-RUN
-*
-* Create JavaScript assignment array of 'Countries'.
-*
TABLE FILE CAR
SUM     COUNTRY NOPRINT
COMPUTE COUNTER1/D3 = COUNTER1 + 1;                     NOPRINT
COMPUTE COUNTER2/D3 = COUNTER1 - 1;                     NOPRINT
COMPUTE COUNTER3/A5 = FTOA(COUNTER2,'(D3)',COUNTER3);   NOPRINT  
COMPUTE JSCNTRYARRAY/A50 = 'aryCOUNTRY[' || TRIM('B', COUNTER3, 5, ' ', 1, 'A5') || 
                           '] = " '      || COUNTRY                              || 
						   '";';
BY COUNTRY NOPRINT
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE SAVE AS CNTRYARY
END
-RUN
-SET &TTLCNTRYS = &LINES + 0;
-*
-* Display web page to user.
-*
-HTMLFORM BEGIN
<HTML>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function()
{
 var aryCOUNTRY = new Array(!IBI.AMP.TTLCNTRYS;);
!IBI.FIL.CNTRYARY;
for (var i = 0; i < !IBI.AMP.TTLCNTRYS;; i++)
	{
 	 $('#cn_table tr').last().after('<tr><TD><input name="CNTRY" value="' + aryCOUNTRY[i]
	  + '" size="14"></TD><TD><input id="YR" name="YR" value="!IBI.AMP.DATEYY;" size="5"></TD></tr>');
	}
});
</script>
</HEAD>
<body>
<TABLE id="cn_table">
<TR>
<TD><b>Country</TD>
<TD><b>Year</TD>
</tr>
</TABLE>
</body>
</html>
-HTMLFORM END

Yields in the browser:

This message has been edited. Last edited by: David Briars,
 
Posts: 822 | Registered: April 23, 2003Report This Post
Platinum Member
posted Hide Post
Thanks David. this worked for me. I made some changes to get it work correctly as mine was a big array.


WF 8.2.01 APP STUDIO
PDF,HTML,EXL2K,Active
 
Posts: 139 | Registered: July 21, 2011Report 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] WebFOCUS data to jquery

Copyright © 1996-2020 Information Builders