MikeNIke
MikeNIke

Reputation: 233

Export to Excel from grid - no data

I am getting an Excel spreadsheet with columns but, no data when I click on the Excel icon on a grid.

I have put a grid on the CR306030 page that is tied to a view of a custom DAC that relates back to the CRActivity record for the page. I have set the SkinID to Inquire and the AllowImport = true. The view in my Graph extension class looks like this:

 [PXImport(typeof(CRActivity))]
 public PXSelect<MyDac, 
    Where<MyDac.activityNoteID,
    Equal<Current<CRActivity.noteID>>>> MyDacView;

I'm not sure what I am missing. I am trying to export the data in the grid so, I may be way off here.

TIA!

Upvotes: 0

Views: 484

Answers (2)

MikeNIke
MikeNIke

Reputation: 233

This happened because I had an update() call inside of a FieldSelecting() event handler. This, for some reason, caused the export to quit working. This presents another problem for me that I will post in another question but, the export issue is resolved. Here's what my code looked like in the extended graph that was causing the issue:

 protected virtual void CRActivity_UsrCustomField_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
 {
      CRActivity activity = (CRActivity) e.Row;
      CRActivityExt activityExt = activity.GetExtension<CRActivityExt>();

      // Some code here.

      e.ReturnValue = TotalValue;
      activityExt.UsrCustomField = TotalValue;
      Base.Events.Update(activity);
 }

I changed it to this in order to get the export working:

 protected virtual void CRActivity_UsrCustomField_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e)
 {
      CRActivity activity = (CRActivity) e.Row;
      CRActivityExt activityExt = activity.GetExtension<CRActivityExt>();

      // Some code here.

      e.ReturnValue = TotalValue;
      //activityExt.UsrCustomField = TotalValue;
      //Base.Events.Update(activity);
 }

Upvotes: 1

Hugues Beaus&#233;jour
Hugues Beaus&#233;jour

Reputation: 8268

Adding Export button is all that should be required. Setting SkinID to inquire will do that for you.

It seems you are running into an uncommon scenario so I would suggest to rollback tentative solutions like adding Import functionality that isn't required in case your implementation has errors causing conflicts with export functionality.

Next issue I would suspect is a kind of security/rights issues or an explicit call to disallow exporting records. Removing unnecessary code and substituting the DAC you are using could help expose the root cause as some specific entity could have been locked down by security while others aren't.

If you're familiar with Acumatica web services it could be worth a shot to test if records from the grid can be retrieved by web service. If they can't then that points towards security/rights issues.

Upvotes: 0

Related Questions