[CLOSED] Get Parameter values into URL in WebFOCUS Designer Javascript
I have a simple report with two filters (&COUNTRY and &BODYTYPE) which create respective multiselect dropdowns in a designer page.
-DEFAULT &COUNTRY = _FOC_NULL; -DEFAULT &BODYTYPE = _FOC_NULL; TABLE FILE CAR BY CAR.ORIGIN.COUNTRY BY CAR.COMP.CAR BY CAR.CARREC.MODEL BY CAR.BODY.BODYTYPE WHERE CAR.ORIGIN.COUNTRY EQ &COUNTRY.(OR(FIND CAR.ORIGIN.COUNTRY,CAR.ORIGIN.COUNTRY IN car|FORMAT=A10)).Country:.; WHERE CAR.BODY.BODYTYPE EQ &BODYTYPE.(OR(FIND CAR.BODY.BODYTYPE,CAR.BODY.BODYTYPE IN car|FORMAT=A12)).Body Type:.; ON TABLE SET PAGE-NUM NOLEAD ON TABLE SET ASNAMES ON ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLEMBEDIMG ON ON TABLE SET HTMLCSS ON ON TABLE SET STYLE * INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/warm.sty, $ ENDSTYLE END
I am trying to pass the parameter values to another procedure (cardetail.fex) that looks like
-DEFAULT &COUNTRY = _FOC_NULL; -DEFAULT &BODYTYPE = _FOC_NULL; -TYPE Countries selected are: &COUNTRY -TYPE Body Types selected are: &BODYTYPE
Below is the javascript I added in the designer page to call cardetail.fex and pass parameters to it. However, I get inputVal as undefined. Could someone help me pass &COUNTRY and &BODYTYPE variables to the URL?
window.addEventListener("iba_pageloading", function (e){ var panel = document.querySelector(".carFile").ibaObject; // carFile is the class name I gave to the panel that has the report output var ibsite = panel.addButton({ "glyphClasses": "fa fa-home", "class": "ibButton", "tooltip": "Click to display help."}, ".pd-container-title-button-resize", true); ibsite.addEventListener("click", function(){ var url = '/ibi_apps/WFServlet.ibfs?IBFS1_action=RUNFEX&IBFS_path=IBFS:/WFC/Repository/test/cardetail.fex' ; url = url + '&COUNTRY=' ; alert (url); var inputVal = document.getElementsByClassName("countryVal").value; // countryVal is the class name I gave to the filter dropdown of &COUNTRY alert(inputVal); window.open(url);
Thanks!This message has been edited. Last edited by: FP Mod Chuck,
WebFOCUS 8.1.05 Windows 10
September 01, 2020, 10:23 AM
MartinY
Try this instead to retrieve countryVal
var inputVal = IbComposer_getCurrentSelection('countryVal');
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
September 01, 2020, 03:42 PM
Waz
I don't think Composer calls will work with Designer.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
September 01, 2020, 04:45 PM
MartinY
quote:
Originally posted by Waz: I don't think Composer calls will work with Designer.
If it's the case then it's going to be an issue when migrating from AS to Designer...if ever it's possible...
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
September 01, 2020, 04:54 PM
Radhika005
Martin,
var inputVal = IbComposer_getCurrentSelection('countryVal'); -- Did not work. It is throwin a Javascript Reference error: IbComposer_getCurrentSelection is not defined.
Martin and Waz any other ideas on how I can accomplish this?
Thanks!
WebFOCUS 8.1.05 Windows 10
September 01, 2020, 06:52 PM
Waz
Designer is a completely new beast.
There is information beginning to show up related to js etc. But there doesn't seem to be much.
We were even thinking of using composer pages in an interim to drive the reports and charts in designer, but at the time there was no way to "inject" the parameters easily or nicely.
Not sure of the state is now.
I have seen a list of short videos on how-to's related to designer, but not sure where it is.
Will update if I find it.
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
September 02, 2020, 09:25 AM
Michele Brady
You can find videos on WebFOCUS Designer here: Designer videos and you can also find these on YouTube.
Director, Technical Content Support Services
September 02, 2020, 10:43 AM
Radhika005
quote:
Originally posted by Michele Brady: You can find videos on WebFOCUS Designer here: Designer videos and you can also find these on YouTube.
Thank you Michele. I couldn't find any video related to my specific issue which is getting parameter values from designer page.
Is there someone in Product I could reach out to?
WebFOCUS 8.1.05 Windows 10
September 02, 2020, 01:53 PM
FP Mod Chuck
Radhika005
You will need to open a case with techsupport to get additional help.
Thank you for using Focal Point!
Chuck Wolff - Focal Point Moderator WebFOCUS 7x and 8x, Windows, Linux All output Formats
September 10, 2020, 04:35 PM
Radhika005
Looks like John Lewis had already worked on this. I also opened a case to see if IBI has a simpler solution to this with some IBI functions.
Below is the Javascript that I borrowed from John to make it work for this example. Also the values passed into the url will be the display values.
window.addEventListener("iba_pageloading", function (e){ var panel = document.querySelector(".carFile").ibaObject; // carFile is the class name I gave to the panel that has the report output var ibsite = panel.addButton({ "glyphClasses": "fa fa-home", "class": "ibButton", "tooltip": "Click to display help."}, ".pd-container-title-button-resize", true); ibsite.addEventListener("click", function(){ exportExcelRpts(); });
}); function exportExcelRpts(){ var url = '/ibi_apps/run/IBFS/WFC/Repository/test/cardetail.fex' ; url = url + '?COUNTRY=' + getDDValue('countryval','ms') ; //countryval is the class name I gave to the &COUNTRY filter dropdown url = url + '&BODYTYPE=' + getDDValue('bodytypeval','ms') ; //bodytypeval is the class name I gave to the &BODYTYPE filter dropdown window.open(url); } function getDDValue(dd,f){ var dd = document.getElementsByClassName(dd)[0].children[0]; var dd1 = dd.children[1]; var dd2 = dd1.children[0];