How to remove extra header from excel export from GI - acumatica

When I export GI data to excel, it does export some header info such as GI name, filter, etc. Where as if I export any data from grid such as SO Line items, it does not export any header info. Does anyone has any idea how can I get rid of those extra header info when I export it to excel from GI. Or it would have been better if there is any option (check/uncheck) whether one needs these header or not while export GI data.

No option is available to export GI to Excel without header because of the DashboardType attribute decorating PXGenericInqGrph class (PXGenericInqGrph is used to open every GI in the application):
[DashboardType(PXGenericInqGrph.DASHBOARD_TYPE, PXGenericInqGrph.DASHBOARD_CHART_TYPE)]
public partial class PXGenericInqGrph : PXGraph<PXGenericInqGrph>
{
...
}
As a workaround you can create a custom inquiry screen, that will not have DashboardTypeAttribute.
For additional information, you might also check Can I add a custom header to exported Excel file? thread

Related

Using a custom table/DAC in a generic inquiry in 2020R2

I am upgrading a customization project from 2019R1 to 2020R2. I have several custom tables/DACs that I reference within generic inquiries. In 2019R1, I'm able to select from these and it works fine without error.
In 2020R2, an obsolete table error is raised for existing customizations and I'm not able to select new custom DACs at all.
Is there an attribute or another way to suppress this error and allow visibility of new custom DACs so they can be used within generic inquiries?
Here is the code for my custom DAC:
namespace P1S
{
[System.SerializableAttribute()]
[PXCacheName("P1S Shipment Serial Nbrs.")]
public class PSSOShipSerialNbrs : PX.Data.IBqlTable
{
... column definitions ...
}
}
Unpublishing all customizations and then re-publishing from the main Customization Project screen (SM.20.45.05) fixes the error. Custom DACs are also now visible in the table selector.

Using Load Records from File on Custom Table

I want to set up the Load Records from File button on a custom table grid that I added to the ProjectEntry_Extension BLC. I have the view set up with PXImport:
[PXImport(typeof(CFPMItemReq))]
public PXSelect<CFPMItemReq, Where<CFPMItemReq.projectID,
Equal<Current<PMProject.contractID>>>> ItemReqs;
I set the grid Mode -> Allow Update = true. I added IItemPlanMaster to the DAC of CFPMItemReq:
[Serializable]
public class CFPMItemReq : IBqlTable, IItemPlanMaster
{
....
}
However, when I go to upload the file, nothing happens. The button opens the file browser, I select the file, click upload, and the window just closes and nothing happens. I double checked and the excel file is formatted properly with the IDs of the columns in the first row. I'm not sure what I'm missing to get this working.
If using PXImport on a view in your extension which is based on ProjectEntry, you will need to use the primary DAC of that graph which should be PMProject like this...
[PXImport(typeof(PMProject))]
public PXSelect<CFPMItemReq, Where<CFPMItemReq.projectID,
Equal<Current<PMProject.contractID>>>> ItemReqs;
Here are similar questions:
Nothing happen after click upload excel
Adding “AllowUpload” to the landed code tab in the Bill and adjustment screen

How to open a custom screen from a GI made from that custom screen DAC

We have a custom screen and two DACs (header and detail) that feed that custom screen. We also have a GI that is based on the values in the detail DAC. The custom screen's header has two key values. What we'd like to be able to do is use one of the fields of the GI as a hyperlink to open our custom screen, passing two of the values from the GI into the Header's key fields. I'd like to know if this is possible.
I understand how to create a new graph object for my custom screen in a graph extension and create a button to make a hyperlink, but since the GI doesn't have any graph to extend, it's a bit of a mystery...
I believe the required behavior is only achievable since ver. 6, where in the Generic Inquiry Designer you have the Navigation tab to configure how values from the GI will be passed into the Header's key fields:

Liferay list export

I am displaying list of my custom objects on liferay portlet.
Now my problem is I want to provide Export feature to user.
There will be export link below list displayed.
When user click on that button it will download the displayed list as excel file.
I am generating excel file while generating the list for display.So, now my problem is how exactly export link should behave.
My export button code.
<portlet:actionURL name="exportURL" var="exportURL"></portlet:actionURL>
<p>← Export</p>
One approach I am thinking is after generating excel file I can upload it in Document library of Liferay and then provide download link as export link on portlet is it a good approch?
Instead of using <portlet:actionURL> you want to use <portlet:resourceURL>. This triggers the resource-phase of the portlet where you can serve other content types than just HTML snippets, e.g. Excel types.
I have the impression that you nailed the excel export itself already and just need an idea how to get to the export from the portlet UI, right? In serveResource you get a ResourceRequest and ResourceResponse object and can set the Mimetype for the response (and its OutputStream)
You should generate the file only after user clicks the link for export as adarshr has written in comment to your question. It will be useless waste of server resources if you generate the file and upload it to download center every time the list will show in the portlet.
You can use poi-2.5.1.jar for excel file generation in java.
Make use of serveResource method.
Below code snippet ,you can make use of.\
Workbook workBook = new HSSFWorkbook();
Sheet sheet = workBook.createSheet("new sheet");
Row row = sheet.createRow((short)0);
Cell cell = row.createCell(0);
//set row,cell value as per your custom entity
resourceResponse.setContentType("application/vnd.ms-excel");
OutputStream out = resourceResponse.getPortletOutputStream();
workBook.write(out);
HTH,
Regards

Salesforce - Export a custom contacts view to Excel

Is it possible to export a custom contact view to Excel? I have a button that goes to the ExportContacts.page that is defined like:
<apex:page standardController="Contact" contenttype="application/vnd.ms-excel" recordSetVar="contacts" extensions="ExportContactsExtension" >
<apex:pageBlock title="Contacts">
<apex:pageBlockTable value="{!contacts}" var="contact">
<apex:column value="{!contact.LastName}"/>
<apex:column value="{!contact.FirstName}"/>
<apex:column value="{!contact.Name}"/>
<apex:column value="{!contact.MailingCity}"/>
<apex:column value="{!contact.Phone}"/>
<apex:column value="{!contact.Fax}"/>
<apex:column value="{!contact.MobilePhone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>
The ExportContactsExtension.cls is defined like:
public class ExportContactsExtension {
public ExportContactsExtension(ApexPages.StandardSetController controller) {
//set the page size so all records will be exported
controller.setPageSize(controller.getResultSize());
}
}
The question is can I export the specific fields specified in the contacts view? On the ExportContacts.page, I have to define the fields to export, like last name, first name, etc. Now if I create a new contacts view and add say the email address, I'll see it on the page, but if I click the export button, it doesn't include the email address. Can I make that export dynamic to include all of the values from the current view?
Why exactly you need such view in first place? Is there some complex logic in controller for selecting the records?
If the query for them can be written in standard SOQL (like [SELECT FirstName, LastName, MailingCity, Phone, Fax, MobilePhone FROM Contact]), then it might be much more effective for you to export records with Data Loader or Excel plugin called "Excel Connector".
And if you need to be able to both export and (pre)view the data on the Salesforce page - consider creating a report? That's what they are for and there's built-in functionality to export to Excel or CSV.
Unfortunately what your asking is not possible with apex today. To do this you'd need a way to query what the page layout was for the record being view and then inspect which fields are visible.
You can export your results to Excel by using the contentType attribute on the apex:page component. See the following post:
Visualforce Export to Excel / IE Bug

Resources