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     Changing fex Target in XML Request

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Changing fex Target in XML Request
 Login/Join
 
Member
posted
I want the Run button on my html page to launch one of two reports, depending on user selection. I think the most elegant method would be to use JavaScript to change the ibif_ex tag value in the XML Request line. However I'm a newcomer to XML, and my readings on w3schools yesterday didn't give me enough info to figure out a way to accomplish this. I'm sure some of you folks have done this before--suggestions, please?


Richard the Blackhearted
Scourge of the Internet

WebFOCUS 7.6.4, AIX 5.3, Win XP Pro SP2 / MRE / Oracle / MS SQL
 
Posts: 12 | Location: Boston, MA | Registered: July 11, 2007Report This Post
Guru
posted Hide Post
quote:
n button on my html page to launch one of two reports, depending on user selection.



Richard,

I am not sure if I am understanding your question properly. Why don't you have the RUN button point to a fex and from there based on your selection you can branch out to execute one of the other two focexec?


WF 8.x and 7.7.x Win/UNIX/AS400, MRE/Portal/Self-Service, IIS/Tomcat, WebSphere, IWA, Realmdriver, Active Directory, Oracle, SQLServer, DB2, MySQL, JD Edwards, E-BIZ, SAP BW, R/3, ECC, ESSBASE
 
Posts: 285 | Location: Texas | Registered: June 27, 2006Report This Post
Member
posted Hide Post
Yes Sayed, I could do that--in fact, I have a fex set up to do exactly that, as my fallback. It just seems clunky to me, and I wanted to learn to manipulate the XML request lines with JavaScript, if possible.


Richard the Blackhearted
Scourge of the Internet

WebFOCUS 7.6.4, AIX 5.3, Win XP Pro SP2 / MRE / Oracle / MS SQL
 
Posts: 12 | Location: Boston, MA | Registered: July 11, 2007Report This Post
Expert
posted Hide Post
From my personal JavaScript library, a function that replaces the value of an amper parameter in a string. The string is usually a URL that is a WebFOCUS call. You call the function passing the URL, the parameter name and the new value, so in your case it would be fnReplaceParmValue(yourURL,'IBIF_ex','newPgmName');

// Function to replace the value of a selected WebFOCUS Parm with another value
function fnReplaceParmValue(vURL,vParm,vValue)
{
vParmString = '&' + vParm + '=';

vStringPosition = vURL.indexOf(vParmString);

// If the parm does not exist in the string, simply add it to the end of the string
// else insert the new value ito the string
if (vStringPosition == -1)
  {
  vNewURL = vURL + vParmString + vValue;
  }
else
  {
vNextParmPosition = vURL.indexOf("&", vStringPosition + 1);

vURLBeforeParm = vURL.substring(0, vStringPosition);

if (vNextParmPosition == -1)
  vURLAfterParm = "";
else
  vURLAfterParm = vURL.substring(vNextParmPosition, vURL.length);

vNewURL = vURLBeforeParm + vParmString + vValue + vURLAfterParm;
  }
/*
alert("Old URL: " + "\n" + vURL + "\n" +
      "New URL: " + "\n" + vNewURL);
*/
return vNewURL;
}


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
Well, the IBIF_ex variable is located in a form, as are all the other user selections.
So, what you could do is have a piece of javascript examine the user selections and based on that change the value of IBIF_ex.
Something like:
if (document.forms.formname.uservar.value == 'choice') { document.forms.formname.IBIF_ex.value = 'fex1';}

Try it (or something very much like this).
Let me know if it works for you.

Gerard


GamP

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

Try something like this in the JS within your HTML page -

function onSubmit () {
  ibif_ex = document.getElementById("IBIF_ex");
  userSel = document.getElementById("what ever your control Id value is for the user selection").value;
  if (userSel == "firstchoice") {
    ibif_ex.value = "firstchoice.fex";
  } else {
    ibif_ex.value = "secondchoice.fex";
  }
  document.form.submit();
}

Just change your submit button to a type of "button" instead of "submit" and then add the code OnChange="onSubmit();" to the button code.

There are many ways to achieve this and this is only one of them. It is a more simplistic method that some but will hopefully remain understandable by you, your colleagues or anyone else who has to support the end result.

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
Francis, GamP, and Tony, thank you all for your replies.

"ibif_ex" is an attribute of the <Request> node in the <Requests> XML document generated by the Dev Studio html page design tool. From my reading, it seems like there should be an easy way to use JS to reference that attribute and its value via the XML DOM--but I'm just not finding it, and it's time to move on, for now. The XML tutorial I'm reading shows how to reference an external XML file that you load into the html page, but the WF XML document is embedded in the html, and the tutorial doesn't cover this eventuality. Someday maybe I'll figure this out, but for now I'm just going to use my clunky fex file to branch to the correct report.

Thank you all anyway...


Richard the Blackhearted
Scourge of the Internet

WebFOCUS 7.6.4, AIX 5.3, Win XP Pro SP2 / MRE / Oracle / MS SQL
 
Posts: 12 | Location: Boston, MA | Registered: July 11, 2007Report This Post
Gold member
posted Hide Post
This can be accomplished using the following code.
// get the xml data
var ibiXML = document.getElementById('ibi_requests');
// get the request object
var request = ibiXML.selectSingleNode("//requests/request");
request.setAttribute('ibif_ex','app/my_new_fex_name.fex');


Of course if you have more than one request object, you will need to select the correct one... //requests/request[@requestId=number]



Windows: WF 7.6.2: SQL Server 2008 R2
 
Posts: 86 | Location: Chicago | Registered: August 03, 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     Changing fex Target in XML Request

Copyright © 1996-2020 Information Builders