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     [CLOSED] variable table name during webfocus call
Page 1 2 

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] variable table name during webfocus call
 Login/Join
 
Member
posted
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,
 
Posts: 24 | Registered: April 19, 2006Report This Post
Platinum Member
posted Hide Post
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, 2005Report This Post
Expert
posted Hide Post
My guess is that your code looks like this:

<select name=...>
< !--WEBFOCUS TABLE variable tablename -->
</select>

As far as I can recall, < !--WEBFOCUS TABLE... is old technology - the current syntax is !IBI.FIL..., so your code should look like this:

<select name=...>
!IBI.FIL.&VARNAME;
</select>

where &VARNAME is the WebFOCUS Dialog Manager variable - it does not have to be created inside a JavaScript variable.


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
Member
posted Hide Post
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:
<select name="DIVISION">
<option value='$*' selected>All</option>
<!--WEBFOCUS TABLE DIVISION -->
</select>


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.

I hope this time it's clearer.
Thank you,
Evgenia
 
Posts: 24 | Registered: April 19, 2006Report This Post
Expert
posted Hide Post
Evgenia,

Check my response.

Francis.


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
Member
posted Hide Post
Thanks Francis,
I've tried that combination before. This is the error message:
(FOC36232) UNABLE TO LOCATE END OF !IBI ESCAPE SEQUENCE.

Evgenia
 
Posts: 24 | Registered: April 19, 2006Report This Post
Platinum Member
posted Hide Post
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, 2005Report This Post
Platinum Member
posted Hide Post
quote:

<select name=...>
!IBI.FIL.&VARNAME;
</select>



I haven't seen it before with the '&'. So I believe that it should be !IBI.FIL.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, 2005Report This Post
Expert
posted Hide Post
Did you forget the ; at the end of the !IBI.FIL line?

Here is a quick piece of code illustrating the !IBI.FIL syntax with a variable file name:

TABLE FILE CAR
PRINT CAR
ON TABLE HOLD AS HOLD1
END
-RUN

-SET &HFILE = 'HOLD1';

-HTMLFORM BEGIN
!IBI.FIL.&HFILE;
-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
Platinum Member
posted Hide Post
OK, I see what you're doing Francis.

So that works OK with the FIL versus the AMP?


------------------------------------------------------------------------
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, 2005Report This Post
Member
posted Hide Post
This is my code:
<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:
 
<select name="SALESMAN">
<option value='$*' selected>All</option>
!IBI.AMP.&MY_SELECT;
</select>
 


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?!?

And Francis, I did not forget ';'

Thank you.
 
Posts: 24 | Registered: April 19, 2006Report This Post
Platinum Member
posted Hide Post
Try initializing &MY_SELECT up above:

-SET &MY_SELECT = '';


------------------------------------------------------------------------
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, 2005Report This Post
Expert
posted Hide Post
smiths,

I think this should work for both FIL and AMP.

FIL is a hold file containing one or more values usually used as options in a select box.

AMP is an amper variable usually containing a piece of text.


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
Member
posted Hide Post
MY_SELECT is passed from the previous file and is uncoded fine in the 'name' attribute.
 
Posts: 24 | Registered: April 19, 2006Report This Post
Expert
posted Hide Post
<option value='$*' selected>All</option>
!IBI.AMP.&MY_SELECT;
</select>

should be

<option value='$*' selected>All</option>
!IBI.FIL.&MY_SELECT;
</select>


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
Member
posted Hide Post
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.
 
Posts: 24 | Registered: April 19, 2006Report This Post
Platinum Member
posted Hide Post
Evgenia,

Can you tell us if your code works if you replace < !--WEBFOCUS VAR &MY_SELECT --> with XYZ temporarily?

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, 2005Report This Post
Expert
posted Hide Post
And, could you please tell us if this working sample works in your environment?

TABLE FILE CAR
PRINT CAR
ON TABLE HOLD AS HOLD1
END
-RUN

-SET &HFILE = 'HOLD1';

-HTMLFORM BEGIN
!IBI.FIL.&HFILE;
-HTMLFORM END

As well, please tell us what your WebFOCUS environment is.


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
Member
posted Hide Post
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 -->) --> 

Thanks.
 
Posts: 24 | Registered: April 19, 2006Report This Post
Expert
posted Hide Post
Try this:

TABLE FILE CAR
PRINT CAR
ON TABLE HOLD AS HOLD1
END
-RUN

-SET &HFILE = 'HOLD1';

-SET &IBI_FIL = '!IBI.FIL.' || &HFILE || ';';

-HTMLFORM BEGIN
&IBI_FIL
-HTMLFORM END

By the way, I'd be very surprised that Dev Studio 7.1 would generate code like:

< !--WEBFOCUS TABLE (<!--WEBFOCUS VAR &MY_SELECT -->) -->

My assumption is that WEBFOCUS TABLE and WEBFOCUS VAR were replaced by !IBI.FIL and !IBI.AMP, but I could be wrong.

Francis.

This message has been edited. Last edited by: Francis Mariani,


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
Platinum Member
posted Hide Post
Evgenia,

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, 2005Report This Post
Member
posted Hide Post
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.

I'll let you know in a sec.
 
Posts: 24 | Registered: April 19, 2006Report This Post
Member
posted Hide Post
Both samples work fine. I wonder if different sequences of special characters in HTML file bring in problems?
 
Posts: 24 | Registered: April 19, 2006Report This Post
Platinum Member
posted Hide Post
So can you use the syntax that we suggested, or are we not on the right track?


------------------------------------------------------------------------
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, 2005Report This Post
Member
posted Hide Post
The second IBI.... in this
 <select name="!IBI.AMP.MYSELECT;">
<option value='$*' selected>All</option>
!IBI.FIL.&MYSELECT;
</select> 

gives the following error:
 (FOC36232)  UNABLE TO LOCATE END OF !IBI ESCAPE SEQUENCE. 
 
Posts: 24 | Registered: April 19, 2006Report This Post
Platinum Member
posted Hide Post
A differente aproximation:

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

Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
<JG>
posted
Evgenia, Look at this old post

https://forums.informationbuilders.com/eve/forums/a/tpc/...391010751#5391010751

It generates fully dynamic selection boxes but you could mod it quite easily to
make only the last one dynamic.
 
Report This Post
Member
posted Hide Post
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.

Evgenia
 
Posts: 24 | Registered: April 19, 2006Report This Post
Expert
posted Hide Post
Probably because the HTML is not interpreted using webfocus and therefore the concept of a webfocus variable doesn't exist.

However, when the fex include the HTML, any variable or webfocus value used within !IBI.FIL or !IBI.AMP will be OK.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
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 Frowner
 
Posts: 24 | Registered: April 19, 2006Report This Post
  Powered by Social Strata Page 1 2  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] variable table name during webfocus call

Copyright © 1996-2020 Information Builders