Discussion
init AG
DE
Last activity: 4 Oct 2018 11:08 EDT
Unable to call export to excel activity on the click of button . The standalone activity works fine.
When I standalone run the activity to export the records in an excel it works fine. But on the click of button in a section when I call this activity nothing happens. I checked the tracer, the activity is getting called but the excel popup does not show up.
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
IN
Hi Sumeet, Good Morning!
Could you please try configuring the API 'Open URL In Window' as onClick event for the pxButton and share your observations.
Thank you!
psahukaru
Navy Federal Credit Union
US
Hi Sumeeth,
If your are configuring the button action with run activity and having show-harness in that run activity will not return any results.Either you should use Show-Harness with acitivity name and harness name or "Open URL In Window"
Please provide the screenshots that how you have configured the button, So that we will get more idea on that.
Note: Button actions "Run Activity" will supress the results from the activity.
Regards
Sai_INCESSANT
EAI Systems
US
init AG
DE
The open url in window works fine for me.But the excel file is giving a default name as "!OpenPortal". Can I customize this name?
-
Siva Shreya Kanukollu THORLIKONDA Gopi
Coforge DPA
GB
You can try something like below code :
---------- ---------------------------------------
String CaseFile = tools.findPage("pyWorkPage").getProperty("pyID").getStringValue();
String fileName = CaseFile + "_" + new java.text.SimpleDateFormat("ddMMyyyy").format(new java.util.Date())+ ".xls";
Page objHeadersPage = getProperty("pxRequestor.pyHTTPResponseHeaders").getAsPage();
if (objHeadersPage.isBound())
{
objHeadersPage.setValue("contentType" ,"application/vnd.ms-excel");
objHeadersPage.setValue("ContentDisposition" ,"attachment;filename=\"" + fileName + "\"");
sendData("", strData.toString());
}
else
{ sendData("","Error. Can't get \"pxRequestor.pyHTTPResponseHeaders\" page");
}
Scotiabank
CA
Add Refresh section event on click of button and give the activity name.As shown above
It is working for me.
Coforge DPA Pvt. Limited
IN
i exactly did what the above screenshot is showing. However, the activity is not getting called at all. Instead the submit button is refreshing the current section only. please advice on what needs to be done to call the activity :(
Coforge DPA Pvt. Limited
IN
I am working on version 7.1.2
Virtusa
US
HI,
You can achive this in 2 ways.
1.On click of button action give LaunchURLInWindow and in activity give your activity
2. On click launch a harness(you can use autoclose harness in Work- Class) and in activity giv your activity
Note both the options will works from IE 9. In IE 8 it doesnt work for me
Sixworks
GB
Option 2 worked perfectly in my case.
Thanks
Virtusa
IN
ExportToExcel activity is asking for pyFileData as a parameter.What should we pass to export all results in a grid in to Excel.
ExportToExcel activity is asking for pyFileData as a parameter.What should we pass to export all results in a grid in to Excel.
Virtusa Corp.
US
Parameter pyFileData contains the data to be populated in the excel sheet,
1) Create an html stream rule containing the below code
<html>
<body>
<table border="1">
<tr>
<th>Case ID</th>
</tr>
<pega:forEach name="resultsPage.pxResults"><!-- resultsPage containing results which need to be shown in the excel sheet-->
<pega:withEmbedded name="$THIS">
<tr>
<%
String ID= tools.getStepPage().getString("pyID");
tools.appendString("<td wrap>" + ID + "</td>");
%>
</tr>
</pega:withEmbedded>
</pega:forEach>
</table>
</body>
</html>
2) in an activity place property-Set-HTML method and pass above created HTML rule and Param.pyFileData as parameters
3) call ExportToExcel in the next step of the activity and you can see the excel getting created from the pagelist availble in the clipboard.
Virtusa
IN
Can you explain indetail because it is not working fine.
I have my results in ContactsList.pxResultspage. I changed your code as you mentioned(just replaced page name) & stored the HTML rule created into a property and used that property as a parameter for ExportToExcel activity.But it is not working.I thing there is a problem with HTML code.
Thanks in advance.
Tata Consultancy Services
IN
Thanks much Raghu, that worked and the excel got created.
But how could i control the File name?
I was trying to add the below code in the ExportToExcel activity, which I was trying to save as in my Ruleset. But resulted in compilation errors
String CaseFile = tools.findPage("pyWorkPage").getProperty("pyID").getStringValue();
String fileName = CaseFile + "_" + new java.text.SimpleDateFormat("ddMMyyyy").format(new java.util.Date())+ ".xls";
Page objHeadersPage = getProperty("pxRequestor.pyHTTPResponseHeaders").getAsPage();
if (objHeadersPage.isBound())
{
objHeadersPage.setValue("contentType" ,"application/vnd.ms-excel");
Thanks much Raghu, that worked and the excel got created.
But how could i control the File name?
I was trying to add the below code in the ExportToExcel activity, which I was trying to save as in my Ruleset. But resulted in compilation errors
String CaseFile = tools.findPage("pyWorkPage").getProperty("pyID").getStringValue();
String fileName = CaseFile + "_" + new java.text.SimpleDateFormat("ddMMyyyy").format(new java.util.Date())+ ".xls";
Page objHeadersPage = getProperty("pxRequestor.pyHTTPResponseHeaders").getAsPage();
if (objHeadersPage.isBound())
{
objHeadersPage.setValue("contentType" ,"application/vnd.ms-excel");
objHeadersPage.setValue("ContentDisposition" ,"attachment;filename=\"" + fileName + "\"");
sendData("", strData.toString());
}
else
{ sendData("","Error. Can't get \"pxRequestor.pyHTTPResponseHeaders\" page");
}
Is there any other way you could provide?
Virtusa
IN
Hi Shalini/Raghu,
Would you please help me in Exporting the date in ContactsList.pxResultspage in clipboard to Excel sheet.I tried with the above code by changing the results page & it is not working.Will you explain me in detail if I'm missing anything.
Thanks in advance.
Tata Consultancy Services
IN
Hi Pradeep,
Is that ContactsList.pxResultspage or ContactsList.pxResults you used?
Have you declared the ContactsList.pxResults in the Pages and Class tab of HTML Stream rule?
- ContactsList -> Code-Pega-List
- ContactsList.pxResults -> CLASS NAME GIVEN IN THE PAGE DEFINITION OF THE PAGELIST (ContactsList)
Please explain in detail about the steps you have done.
Virtusa
IN
Hi Shalini,
First I browsed the data into ContactsList page of type Code-Pega-List by Obj-Browse method.Later I used ContactsList.pxResults in the above HTML code.I haven't declared ContactsList.pxResults in the Pages and Class tab of HTML Stream rule.Thats all I did.
Tata Consultancy Services
IN
Ok, please declare the pagelist in the Pages and Class tab and try (It shouldn't have allowed you to save the HTML rule without declaring the page, not sure why it allowed in your case)
May be I am silly, just make sure that all the rules w.r.t to this activity are in the proper class heirarchy.
Virtusa
IN
Shalini,Except changing the results page nothing changes are required in above HTML code or do I need to do any modifications.Please suggest me in detail procedure as it is of high importance for us.
CVS CareMark
US
Hi All,
I have a similar requirement as discussed above.
I have a grid data in a section and there I have placed a link. On click of that link, I need to run an activity and perform some business logic. If all are fine then I need to export the grid data into Excel.
If there are any error observed ib business logic, then i shd not allow the system to pop-up the screen to download excel file.
Can someone help me on this!!!
Pegasystems Inc.
IN
could you please refer to OOTB activity to generate excel file MSOGenerateExcelFile
having a wrapper activity for validations followed by calling the OOTB activity may help.
Virtusa
IN
HI Phani,
Could you please eloborate your suggestion so that it will be useful for me.The activity is asking "FSFileName" as an input parameter.What we need to pass for this parameter.
Pegasystems Inc.
IN
Pegasystems Inc.
IN
for activity MSOGenerateExcelFile.
Parameter are
- FSFileName: FileName.xlsx
- TemplateRFB: uploaded template
- DownloadFile: true
Pegasystems Inc.
IN
CVS CareMark
US
Pradeep,
Below are things you need to pass as parameters:
FAFileName: "TestExcel.xlsx" (Any name that you want to have for the downlaoded document).
TemplateRFB: You will have to upload a sample excel template with columns mapped to clipboard properties like a binary file. While creating binary file you will enter App Name as webwb, FileName as your choice, Extension as xlsx.
So this parameter finally be like "webwb!YourTemplateName!xlsx"
Download: Select this checkbox
Areteans Technology Services
IN
Hi Raghu,
Thanks for your solution approach. It worked. But what i am looking for is some generalized approach. Like i have a customer search screen which has multiple repeat grids. The requirement is to have export to excel functionality for each of the grids. Now if i need to create HTML streams for every section, it would be very poor coding and as well as would take much effort.
There would be different report definitions for each section and so would be different columns/properties for each grid. So can you please help me with this?
Thanks in advance
Virtusa
IN
Hi Anik,
Will you share how you created Excel sheet with repeting grid as it is not working for me.
Thanks in advance
Areteans Technology Services
IN
Hi Pradeep,
step 1: have a report defn or an activity where you form the list containing the results
step 2: in a section use repeat grid and as source use the report defn or the Page List.
step 3: create a html stream rule ( That will specify which columns you want to have in the excel. Get the values from the Pagelist you are using. For the format you can use the one that Raghu has specified.)
step 4: Create an activity (Step 1: Property-Set-HTML Step 2: Call ExportToExcel (OOTB) or your customized activity if you want to change anything)
step 5: in the section where you used the repeat grid, add a button, on click open url in new window , specify the activity name and window name
Thank You
Virtusa
IN
Thanks Anik for your quick response.Still I have some issue like..........
1)How to include the values from PageList in HTML rule.Eg. I want to use pxResults.FirstName & pxResults.LastName.
2)In Property-Set-HTML step,can we set the created HTML fragment in to any property or any specific type.
Thanks in advance
Areteans Technology Services
IN
Hi Pradeep,
Try this :
1. Say you have the columns FName, LName, Age as columns.
Say your resultpage is TempList (of Code-Pega-List) and TempList.pxResults(<<YOUR REQD CLASS>>)
<html>
<body>
Excel Header <br>
<table border="1">
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Age</th>
</tr>
<pega:forEach name="TempList.pxResults">
<pega:withEmbedded name="$THIS">
<tr>
<%
String FName= tools.getStepPage().getString("FName");
tools.appendString("<td wrap>" + FName + "</td>");
String LName= tools.getStepPage().getString("LName");
tools.appendString("<td wrap>" + LName + "</td>");
String Age= tools.getStepPage().getString("Age");
tools.appendString("<td wrap>" + Age + "</td>");
%>
</tr>
</pega:withEmbedded>
</pega:forEach>
</table>
</body>
</html>
2.
in the property-set-html set Param.pyFileData as the HTML that u created and then call ExportToExcel with Pass Current Parameter Page checked.
Hi Pradeep,
Try this :
1. Say you have the columns FName, LName, Age as columns.
Say your resultpage is TempList (of Code-Pega-List) and TempList.pxResults(<<YOUR REQD CLASS>>)
<html>
<body>
Excel Header <br>
<table border="1">
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Age</th>
</tr>
<pega:forEach name="TempList.pxResults">
<pega:withEmbedded name="$THIS">
<tr>
<%
String FName= tools.getStepPage().getString("FName");
tools.appendString("<td wrap>" + FName + "</td>");
String LName= tools.getStepPage().getString("LName");
tools.appendString("<td wrap>" + LName + "</td>");
String Age= tools.getStepPage().getString("Age");
tools.appendString("<td wrap>" + Age + "</td>");
%>
</tr>
</pega:withEmbedded>
</pega:forEach>
</table>
</body>
</html>
2.
in the property-set-html set Param.pyFileData as the HTML that u created and then call ExportToExcel with Pass Current Parameter Page checked.
Cognizant
IN
Step 1. On button Click add action Open URL in Window
Check Use Page Put Activity Name (e.g. TestDataExcel )and then Window Name(e.g. TextExtract)
Step 2. Now set parameter Param.pyReportName(Report Definition Name), Param.pyReportClass(Report Definition Class), Param.pyPageName(ResultPage). Please define Report Result Page in pages and classes as Code-Pega-List and pxResults as the class of your report definition class.
Step 3. Call Rule-Obj-Report-Definition.pxRetrieveReportData.
Step 4. Call Rule-Obj-Report-Definition.pzViewExportToExcel with step page as ResultPage.pyReportDefinition
Hope this will work
-
Rakshith Mende
Wipro Ltd
IN
Hi ,
I have a requirement of Export to Excel , values from pagelist to excel. Iam using OOTB "MSOGenerateExcelFile" passed all the required parameters but iam unable to create any Excel out of this .
Can someone please help on this
This comment has been branched out as a new node and the new thread can be followed here
Pegasystems Inc.
IN
Hi Ramya,
To increase the visibility of your question, we have created a new post for you: Unable to Export to Excel by using MSOGenerateExcelFile
Please continue the discussion over the new post.
Thank you,