0

I want to open a folder from a record pulled up in a form in Epicor. I have created a button and so far it opens up the root folder but I want it to go to a sub-folder with the record's name as the sub folder that will be created from SQL stored procedure when a new record is created.

Here is what I have so far:

    private void epiButtonC1_Click(object sender, System.EventArgs args)
{
    // ** Place Event Handling Code Here **
    string folder = "\\\\MasterServ\\Shared\\Customer Attachments\\";
    Process.Start("IExplore.exe", folder);
}

I know something needs to be added at the end of the location to call the folder using the record but im not sure what.

Van Amburg
  • 1,207
  • 9
  • 15
  • very similar to this: http://stackoverflow.com/questions/1746079/how-can-i-open-windows-explorer-to-a-certain-directory-from-within-a-wpf-app – Andrew Feb 08 '16 at 21:05
  • Similar but mine is a step further. I need it to open a subfolder that is named to the ID which is also displayed in a textbox that is pulled from a SQL table. This needs to happen for each record and each record has different IDs so I need the system to know which folder to open when I click the attachments button. – Dylan Anderson Feb 08 '16 at 21:14
  • I'm confused. You have the code to open folder X, and you're asking how to open folder Y? The same way you opened folder X. – Andy Arndt Feb 08 '16 at 22:14
  • ...so add the ID from your TextBox onto the end of your "folder" variable? `string folder = "\\\\MasterServ\\Shared\\Customer Attachments\\" + textBox1.Text;` – Idle_Mind Feb 08 '16 at 23:05
  • @AndyArndt I am asking how to open folder Y based on a number or description that is displayed in a textbox that I do not know how to. Basically each record has its own folder and I am making a button to open each folder depending on what record I have open in the form. – Dylan Anderson Feb 09 '16 at 13:07
  • @Idle_Mind Yes I attempted this one but I get this error. "The name 'txtKeyField' does not exist in the current context" – Dylan Anderson Feb 09 '16 at 13:12
  • Can you show us some code where you tried to do that? – Andy Arndt Feb 09 '16 at 13:30
  • private void epiButtonC1_Click(object sender, System.EventArgs args) { // ** Place Event Handling Code Here ** string folder = "\\\\MasterServ\\Shared\\Customer Attachments\\" + txtKeyField.Text; Process.Start("IExplore.exe", folder); } – Dylan Anderson Feb 09 '16 at 13:44
  • You need to get the data out of the DataView and not from the control itself. – Van Amburg Feb 09 '16 at 16:10
  • How would I do that the dataview is named UD104 and the field with the data that shares the same name as all my sub-folders is in UD104.Key1 – Dylan Anderson Feb 09 '16 at 16:12

1 Answers1

0

When trying to get data out of a control in Epicor, generally speaking you want to go to the EpiDataView to get the value and not the control itself. There are multiple layers of abstraction going on in the form that make control handling wonky.

From your example for the comments I would do this. Code untested so hopefully I didn't make a typo.

EpiDataView edvUD104 = ((EpiDataView)(oTrans.EpiDataViews["UD104"]));
if (edvUD104.HasRow)
{
   string folder = "\\\\MasterServ\\Shared\\Customer Attachments\\" 
                  + edvUD104.dataView[edvUD104.Row]["Key1"].ToString();
   Process.Start("IExplore.exe", folder);
}

Edited for readability.

Van Amburg
  • 1,207
  • 9
  • 15
  • Here is what I am not getting. UD104 is indeed a view just checked but look at these errors. – Dylan Anderson Feb 09 '16 at 16:29
  • 'Epicor.Mfg.UI.FrameWork.EpiDataView' does not contain a definition for 'dataview' – Dylan Anderson Feb 09 '16 at 16:29
  • Hereis the code private void epiButtonC1_Click(object sender, System.EventArgs args) { EpiDataView edvUD104 = ((EpiDataView)(oTrans.EpiDataViews["UD104"])); if (edvUD104.HasRow) { // ** Place Event Handling Code Here ** string folder = "\\\\MasterServ\\Shared\\Customer Attachments\\" + edvUD104.dataview[edvUD104.Row]["Key1"].ToString(); Process.Start("IExplore.exe", folder); } } – Dylan Anderson Feb 09 '16 at 16:33
  • Btw that error is for Line# 58 which is the + edvUD104.dataview[edvUD104.Row]["Key1"].ToString(); – Dylan Anderson Feb 09 '16 at 16:36
  • I just figured it out not exactly sure what I did but your code works. It might've been the EpiDataNotificationEvent I created – Dylan Anderson Feb 09 '16 at 16:48
  • I think you missed the camel case the first go around. I do it all the time in one way or another. It bugs the crap out of me that that one single public accessor is "dataView" and not "DataView" or even "dataview". – Van Amburg Feb 09 '16 at 16:59