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.
Hi everybody, Is there a way to invoke WebFOCUS from HTML with variable table name? I am looking for something like < !--WEBFOCUS TABLE variable tablename --> The variable value is stored in a JavaScript variable. I tried to create a string in JavaScript by appending different parts. Doesn't work. The goal here is to have dynamic select dropdown. The other four dropdowns are similar for all the reports. The last one should be populated depending on a specific report.
Is this at all possible?
Thanks,This message has been edited. Last edited by: Kerry,
I don't know if I fully understand what you are looking for, but perhaps this is the idea...
You can pass parameters from your HTML/Javascript program to a WebFocus program, and read off the amper variables in the WF program. Below is a snippit for WFServlet mode.
var call_url = "/ibi_apps/WFServlet?IBIF_ex=fextocall" +
"&|TABLENAME=" + document.all.TableName.value
window.open(call_url, "_blank");
Then in fextocall.fex, you can access amper variable &TABLENAME.
Is this what you were looking for?
Sean
------------------------------------------------------------------------ PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
Posts: 210 | Location: Ottawa | Registered: November 03, 2005
Thanks Sean, but I need something different. Sorry for the confusion. I have a frameset where the top frame shows in a form of dropdowns criteria that I can specify before running my report. The dropdowns are populated from webfocus tables. Tables are stored in .ftm files as lists of options for the select element of HTML form:
... To load these tables into select dropdowns, I do following:
where DIVISION is the name of the file where the webfocus table is.
My question is: is it possible to have tables loaded depending on the report I am about to run? I can copy this and hardcode different filename. This means I will have separate file for each report. And the only thing that changes is one of select elements. The other four are the same for all the reports. Like I said, I tried to create JavaScript string by 'adding' two different parts:
var tblname = "DIVISION";
var str = "<!--WEBFOCUS TABLE" + tblname + "-->";
In this case I get WEBFOCUS error that says that FILE &qte is not recognized. If I break that string differently, WEBFOCUS does not react properly on the format that is created by concatanation.
In that case it sounds like Francis' solution is what you are looking for. If your data is held in a file, use the syntax that Francis has described, and if your data is held in an amper variable, use !IBI.AMP.VARNAME; .
Sean
------------------------------------------------------------------------ PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
Posts: 210 | Location: Ottawa | Registered: November 03, 2005
<select name="<!--WEBFOCUS VAR &MY_SELECT>">
<option value='$*' selected>All</option>
!IBI.AMP.&MY_SELECT;
</select>
In this case the name attribute gets the correct value 'SALESMAN' which is also the name of the webfocus table. But !IBI.AMP.&MY_SELECT; gives the following error: (FOC36228) VARIABLE &MY_SELECT SPECIFIED BY WEBFOCUS VAR HAS NEVER BEEN SET
This is how it looks in the source page when I run it:
Sean, without amper sign the error is: (FOC36232) UNABLE TO LOCATE END OF !IBI ESCAPE SEQUENCE. However, shouldn't it tell me that such file cannot be located?!?
With FIL I get: (FOC36232) UNABLE TO LOCATE END OF !IBI ESCAPE SEQUENCE. Interesting, but if instead of
<!--WEBFOCUS VAR &MY_SELECT -->
I use
!IBI.FIL.&MY_SELECT;
for the name attribute I get errors for both appearances: (FOC36232) UNABLE TO LOCATE END OF !IBI ESCAPE SEQUENCE. (FOC36232) UNABLE TO LOCATE END OF !IBI ESCAPE SEQUENCE.
If I use < !--WEBFOCUS VAR &MY_SELECT --> in both spots, then I get the value of MY_SELECT which is SALESMAN in this case, which is understandable. MY_SELECT is a variable that holds the name of the table. Is there such thing as amper of amper? I need the contents of the SALESMAN table.
Sean, I don't know what you mean by 'temporarily'? I put XYZ instead of every occurence of < !--WEBFOCUS VAR &MY_SELECT -->. I don't get errors but my select dropdowns don't get populated.
Francis, The sample works fine. I am using WebFOCUS 7.1 Dev Studio.
How about .EVAL suffix? I am trying different combinations. Can you think of any? Literally, what I need is
< !--WEBFOCUS TABLE (<!--WEBFOCUS VAR &MY_SELECT -->) -->
Does this sample work for you, and can you use this type of syntax instead of the WEBFOCUS TABLE and WEBFOCUS VAR that you are using:
DEFINE FILE CAR
OPTION/A64 = '<option>' | CAR;
END
TABLE FILE CAR
PRINT
OPTION
ON TABLE HOLD AS HCAR
END
-RUN
-SET &TBLNM = 'HCAR';
-HTMLFORM BEGIN
<select name="!IBI.AMP.TBLNM;">
<option value='$*' selected>All</option>
!IBI.FIL.&TBLNM;
</select>
-HTMLFORM END
------------------------------------------------------------------------ PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
Posts: 210 | Location: Ottawa | Registered: November 03, 2005
I will try your suggestions right now. But I wanted to tell you that my file is an HTML file and I am trying to load WebFOCUS tables into select elements. Your sample are fexes with HTML form embedded.
In one of my posts I mentioned that if I replace older syntax with newer, I get twice as many errors.
1.- WebFOCUS - Options list generation. 2.- HTML - Includes all options lists (hidden) 3.- Javascript - Activate/Use the desired option list via javascript.
Example:
SET HOLDLIST = PRINTONLY
-* Option list 1.
TABLE FILE CAR
PRINT
COMPUTE OPTION/A100 =
'<option value="' || COUNTRY || '">' || COUNTRY || '</option>' ;
ON TABLE HOLD AS OPTCOU FORMAT ALPHA
END
-RUN
-* Option list 2.
TABLE FILE CAR
PRINT
COMPUTE OPTION/A100 =
'<option value="' || CAR || '">' || CAR || '</option>' ;
ON TABLE HOLD AS OPTCAR FORMAT ALPHA
END
-RUN
-* Output.
-HTMLFORM BEGIN
<html>
<head>
<script type="text/javascript">
function populate(id, fileid) {
var selobj = document.getElementById(id) ;
var fidobj = document.getElementById(fileid) ;
selobj.length = 0 ;
for (var i=0; i<fidobj.length; i++)
selobj.options[i] = new Option(fidobj[i].text,fidobj[i].value);
}
</script>
</head>
<body>
<form>
<!-- Option list 1 hidden -->
<select id="optcou" style="display: none;">
!IBI.FIL.OPTCOU;
</select>
<!-- Option list 2 hidden -->
<select id="optcar" style="display: none;">
!IBI.FIL.OPTCAR;
</select>
<!-- My option list, populated via javascript -->
<select id="myselect1">
</select>
</form>
<p>
<a href="#" onclick="populate('myselect1','optcou')">Populate with countries</a>
</p>
<p>
<a href="#" onclick="populate('myselect1','optcar')">Populate with cars</a>
</p>
</body>
</html>
-HTMLFORM END
Thanks everybody for your input. It does work in a foc procedure. I just use -INCLUDE myHTMLfile and then everything works. I was wondering why is that reading a table with a variable name in HTML file gives a problem. That's all. I'll go with -INCLUDE. Thanks again.
Such concept exists but very selectively. I am able to retrieve the value of amper variable itself. What I can't do is to give that retrieved value as a table name to another WebFOCUS call