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.
I have the following javascript code that determines which output format to enable depending on the report that is selected in the self-serve page. I need to know how to get this code working so that when the user selects PDF or EXL07, it will run for the correct output format. Right now, when I select either PDF or EXL07 radio buttons, the report only displays in PDF format. Thanks.
-DEFAULT &WFFMT='XLSX';
TABLE FILE ibisamp/CAR
PRINT COUNTRY MODEL CAR
ON TABLE PCHOLD FORMAT &WFFMT.(<HTML,HTML>,<PDF,PDF>,<Excel XLSX,XLSX>,<HTML Active Report,AHTML>).Select type of display output.
END
If you are using something like App Studio, the WFFMT amper variable should be seen by the HTML composer tool and you'll be given a chance to have a user control created automagically. This is one feature of WebFOCUS that I really like a lot.
I know this works because I have created a self-serve application that does what you seem to be trying to do.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
It seems that you have multiple control to manage the output format where, I think, you should have only one control since it's to assign one output value (variable).
One variable (control) that will have multiple options (values) and from which the user will select the output format.
Now you have 5 radio (control) : radioexl07, radioexl2k, radiohtml, radiopdf, radioppt. Create one control with 5 options instead. _____________
Squatch option will work but you won't have control on which option to display as you requested.
With one control having multiple options, you can then control which one to display or not using js or jquery.
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
You mean you can't set an output format user control using JavaScript, especially when IBI provides such functionality?
No, I mean that with format auto-prompting (except if there is a way that I'm not aware of) you cannot control "dynamically" based on another selection, which output format will be displayed : you select once which format you want to be available and it will be the same choices all the time.
Michele is requesting:
quote:
determines which output format to enable depending on the report that is selected
which I don't think is possible using auto-prompting.This message has been edited. Last edited by: MartinY,
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
You mean you can't set an output format user control using JavaScript, especially when IBI provides such functionality?
No, I mean that with format auto-prompting (except if there is a way that I'm not aware of) you cannot control "dynamically" based on another selection, which output format will be displayed : you select once which format you want to be available and it will be the same choices all the time.
Here's the complete code.
Fex (again):
-DEFAULT &WFFMT='XLSX';
TABLE FILE ibisamp/CAR
PRINT COUNTRY MODEL CAR
ON TABLE PCHOLD FORMAT &WFFMT.(<HTML,HTML>,<PDF,PDF>,<Excel XLSX,XLSX>,<HTML Active Report,AHTML>).Select type of display output.
END
Using App Studio, I created a new HTML page. I told it the data source was the fex file shown above. I told HTML composer to go ahead and create a single layer form control for the WFFMT amper variable. It very helpfully read the fex and created a radio control to allow the user to select an output format of HTML, PDF, Excel or Active Report (It even put output format icons in the control... e.g., the Excel choice has the Excel logo next to it). The ID of the control was "radio1".
It also created a submit button. I clicked once on the submit button, then went to "Properties" and clicked on the "Click" event for this submit button. This gave me a chance to run some JavaScript code before the fex ran:
function form1Submit_onclick(event) {
var arr = [];
arr[0] = 'PDF';
IbComposer_setCurrentSelection('radio1', arr, false);
}
I set up an array of one and used that in the IBI function that programmatically allows a user control to be reset to another value. Since the fex defaults to Excel, so did the control. I had the IBI function change it to PDF at the last possible moment before the fex was run. The test run produced a PDF file, and afterward the control showed "PDF" for the selection.
All Michele needs to do is replace my code to reset the output control with whatever logic she requires to determine what the report output should be.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
By the way, if Michele finds it necessary for the user to see what the output format will be BEFORE the submit button is clicked, there is nothing to prevent her from calling a "reset" function after the user changes any control that might affect the output format. This reset function would look at all the user controls as variables and reset the output format. It would need to be called after every control is changed that is such a variable.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
It's nice Squatch what you did. This is a good way if you want to force a specific output but it doesn't give the user a choice of output format; except if I misunderstood your scenario.
What I understood from Michele's request is to have this ability (as an example):
- If reportA then display available output format choices : Exl07, Exl2k and PDF - If reportB then display available output format choices : Exl07 and HTML - If reportC then display available output format choices : Exl07, Exl2k, HTML, PPT and PDF
And this is possible with a dynamic control, not with using format auto-prompting (AFAIK).
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
Okay, that's a tad bit insane but I can see where you can interpret the request that way.
If that's what Michele is really interested in, then not enough information has been provided. We don't know what is or is not being sent to the report. Only that PDF is being generated.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
If I had to deal with this, I would have a JavaScript function that fires every time a user changes a control that affects the output format choices. The function would determine what the new choices are and repopulate a dropdown control. The user would then select one of the valid output choices from this dropdown select. The dropdown would be tied to the WFFMT amper variable in the report.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
If that's what Michele is really interested in, then not enough information has been provided. We don't know what is or is not being sent to the report. Only that PDF is being generated.
I think that the "no matter what" PDF format is generated it's due to the order the variables are received in the fex. Probably the report's format applied is the last one received (based on assumption that one control exist per output type).
quote:
If I had to deal with this, I would have a JavaScript function that fires every time a user changes a control that affects the output format choices. The function would determine what the new choices are and repopulate a dropdown control. The user would then select one of the valid output choices from this dropdown select. The dropdown would be tied to the WFFMT amper variable in the report.
This is what I would do or use js (or jquery) to manage a radio control output format options.
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
Squatch: The output format radio buttons were originally one button. The reason why I separated the radio buttons is because if the user selects report1, for example, I want them to have the capability of choosing only 2 output formats, PDF or EXL07. So when they select report1, I want only PDF & Excel radio buttons enabled and the other 3 output format radio buttons disabled. Although in report1 fex the default output format is PDF, but I want the user to be able to also select Excel output format from the self-serve page and have the report display in Excel format. Currently, when I enable both PDF and Excel output format radio buttons in the self-serve page and select the Excel format radio button, the report still displays in PDF format. I need a way to override the default PDF output format that's coded in report1 fex whenever the user selects Excel format. This is what I need to fix. Thanks for all of the comments from everybody.This message has been edited. Last edited by: Michele Brooks,
So Michele, this is exactly what Squatch and myself suggesting you.
You need one and only one control. Not multiple control that defines available output format.
You can either create a drop downs list that will list the available options that will also be managed dynamically (according to report selected by the user) as per Squatch has previously suggested or as I suggest, use one radio where you will show/hide options according to report selected by the user.
Both solutions will work, your choice. But having multiple controls to in fact manage one "variable" (the output type) is not the better way. It's not that it's not feasible, but you will need much more code IMHO.
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
Thanks for the clarification. Not sure what you mean by IMHO. When it comes to extensive or more complex coding in self-serve pages, I'm a novice. If you get a chance, can you send me an example of how I can show/hide the output formats for one radio button based on a report selected? Thanks so much.
I presume the Report fex files expect a parameter (e.g., &WFFMT) to specify the requested format.
If the control for the format selection were a drop-down list, you could simply chain it to the report-choice control, and have a fex use the Selected Report parameter to return the list of formats available for the selected report in XML format -- without any JS footwork.
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
j.gross, the issue with this choice is that we don't want to give control of the output format to the users. For example, we want to output all html composer fexes that we create to PDF format. The users won't be aware of that and may choose Excel format in the drop-down list. We want to control up front what output format(s) to assign to each report selected. My issue is when the same report can have multiple output formats. Thanks for the suggestion.
If report A supports only PDF, then (if you rig the fex to populate the format choice correctly) PDF will be the only option presented when the user selects report A.
If report B supports PDF and Excel, then those two will be the options available in the drop-down when the user selects report B.
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005
3- Create the fex that will provide data for the output list
TABLE FILE RPTFMTOPT
BY RPTCD
BY OPUTCD
BY OPUTFMT
ON TABLE PCHOLD FORMAT XML
END
-RUN
The solution is not complete, you still need to add some code and perform some research on how to complete it.This message has been edited. Last edited by: MartinY,
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013