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]WF 8009 Multiple Output formats for one self-serve report

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]WF 8009 Multiple Output formats for one self-serve report
 Login/Join
 
Guru
posted
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.

 
//* Enable Output formats PDF and EXL07.  Disable all other radio buttons
       if ((reportselected ==  'ss_p0001_report1.fex') ||
            (reportselected == 'ss_p0002_report2.fex' ||
            ( reportselected == 'ss_p0003_report3.fex') || 
            (reportselected == ss_p0004_report4.fex'))
       {
       document.getElementById("radiopdf").disabled = false;
       document.getElementById("radioexl07").disabled = false;
       document.getElementById("radioexl2k").disabled = true;
       document.getElementById("radiohtml").disabled = true;
       document.getElementById("radioppt").disabled = true;
       document.getElementById("checkbox1_0").disabled = false;
       document.getElementById("checkbox2_0").disabled = false;
      document.getElementById("checkbox3_0").disabled = false;
       document.getElementById("listbox6").disabled    = false;
      document.getElementById("listbox7").disabled    = false;
      document.getElementById("listbox8").disabled    = false;
       document.getElementById("calendar1").disabled   = false;
      document.getElementById("calendar2").disabled   = false;
       }


WF 8009
Windows 7



 

This message has been edited. Last edited by: Michele Brooks,


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Master
posted Hide Post
Michele, this might be easier than you think.

Try this:

-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, 2015Report This Post
Virtuoso
posted Hide Post
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, 2013Report This Post
Master
posted Hide Post
quote:
Originally posted by MartinY:
Squatch option will work but you won't have control on which option to display as you requested.

You mean you can't set an output format user control using JavaScript, especially when IBI provides such functionality?


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Virtuoso
posted Hide Post
quote:
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, 2013Report This Post
Master
posted Hide Post
quote:
Originally posted by MartinY:
quote:
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, 2015Report This Post
Master
posted Hide Post
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, 2015Report This Post
Virtuoso
posted Hide Post
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, 2013Report This Post
Master
posted Hide Post
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, 2015Report This Post
Master
posted Hide Post
I think this is a good case for needing these two lines at the beginning of the report fex in question:

-? &
-EXIT


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Master
posted Hide Post
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, 2015Report This Post
Virtuoso
posted Hide Post
quote:
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, 2013Report This Post
Platinum Member
posted Hide Post
You can do that by finding the request id. You need to update the filename for the request id based on your selection.


8.2.06
Windows, All Formats
 
Posts: 184 | Registered: December 27, 2013Report This Post
Guru
posted Hide Post
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,


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Virtuoso
posted Hide Post
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, 2013Report This Post
Guru
posted Hide Post
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.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Virtuoso
posted Hide Post
IMHO - in my humble opinion

I look what I can do to provide a simple example.


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


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Virtuoso
posted Hide Post
I don't see the issue.

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, 2005Report This Post
Virtuoso
posted Hide Post
In a js function, here a atarting point.
With Google search you can find a lot of sample and code.
function reportSelect_onchange(event) {
    if (reportSelect0.checked == true || reportSelect1.checked == true)
    {
        outputOpt0.style.visibility='visible';
        outputOpt_LABEL_0.style.visibility='visible';
        outputOpt1.style.visibility='hidden';
        outputOpt_LABEL_1.style.visibility='hidden';
        outputOpt0.checked = true;
    }


Where each outputOpt(n) is a radio option for the output format

To create a fex as j.gross suggest, here one way from the many ones available with WF

1- Create a text file (which I saved in baseapp) with the data such as
RPTCD,OPUTCD,OPUTFMT
RPT1,PDF,PDF
RPT1,EXL2K,Excel 2000
RPT1,EXL07,Excel 2007
RPT1,HTML,HTML
RPT1,PPT,PowerPoint
RPT2,PDF,PDF
RPT2,EXL07,Excel 2007
RPT2,HTML,HTML
RPT3,PDF,PDF
RPT3,EXL2K,Excel 2000
RPT3,HTML,HTML
RPT3,PPT,PowerPoint
RPT4,HTML,HTML

2- Generates the associated master file (note that my fisrt row is the field header)
.mas:
FILENAME=RPTFMTOPT, SUFFIX=DFIX    ,
 DATASET=E:\ibi\apps\baseapp\rptfmtopt.txt, $
  SEGMENT=RPTFMTOPT, SEGTYPE=S0, $
    FIELDNAME=RPTCD, ALIAS=RPTCD, USAGE=A4, ACTUAL=A4B,
      TITLE='RPTCD', $
    FIELDNAME=OPUTCD, ALIAS=OPUTCD, USAGE=A5V, ACTUAL=A5BV,
      TITLE='OPUTCD', $
    FIELDNAME=OPUTFMT, ALIAS=OPUTFMT, USAGE=A10V, ACTUAL=A10BV,
      TITLE='OPUTFMT', $

.acx:
SEGNAME=RPTFMTOPT,
  DELIMITER=',',
  HEADER=YES, $

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, 2013Report This Post
Virtuoso
posted Hide Post
#3 should be along the lines of...

TABLEF FILE RPTFMTOPT
PRINT
  OPUTFMT AS NAME
  OPUTCD AS VALUE
WHERE RPTCD EQ '&RPTCD';
ON TABLE PCHOLD FORMAT XML
ON TABLE SET EMPTYREPORT ON
END


TABLEF preserves the order of appearance in the data table.

OPUTFMT could be defined, as a decode of OPUTCD (or vice versa).
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
Thank you both for the examples. I will look into both options to see what is the best option to incorporate. Thanks again.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Virtuoso
posted Hide Post
Our pleasure to help.

Edit your first post and add [SOLVED] at the beginning of the thread's subject.


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, 2013Report This Post
Master
posted Hide Post
Hi Michele,

Did the suggestions resolve your issue?

Thank you everyone!


Sincerely,

Kathleen Butler
Information Builders
 
Posts: 391 | Location: New York | Registered: September 20, 2006Report This Post
Guru
posted Hide Post
Yes. Thanks everyone.

This message has been edited. Last edited by: Michele Brooks,


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report 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]WF 8009 Multiple Output formats for one self-serve report

Copyright © 1996-2020 Information Builders