Ron R Ron R - 2 months ago 38
C# Question

Epicor 10 Custom Export from Dashboard

I have created a Epicor Dashboard that contains a date range search and the users want to push a button for the grid data to be exported into a txt file. I can build the txt format prior to gathering data.
I am having issues getting looping through the Epicor grid. I know how to load or create the txt file using C#, is there any special things i would need for Epicor to allow the code?

Ron

Answer

The one thing i forgot was I had to publish the dashboard and also put it on the menu. Once that was done I was able to open the dashboard in developer mode and add a customization which is where I added my new button. I added a click event for the button using the event wizard. Then I was able to add my code which included removing two columns from printing on txt file. Code:

 epiDataView edvPP =((EpiDataView)(oTrans.EpiDataViews["DataView From Grid"]));
      int Count = 0;
      int i = 0;
      using (System.IO.StreamWriter sw = new      System.IO.StreamWriter(@"C:'Location'\Test.txt"))


{
     foreach(DataRow dr in edvPP.dataView.Table.Rows)
      {
        object[] ay = dr.ItemArray;
        for (i=0; i < Count - 1; i++)
           {
             sw.Write(ay[i].ToString() + "");
           }
         sw.WriteLine(ay[i].ToString());
       }
    }