Is it possible to change the path of a URL View in a dashboard programatically?

I need to change the Path of the URL to open our network on the right client folder based on the project # which is a field in my dashboard and is accessible through the customization

In Customization, I see something called URLPanel1 wit a EpiGuid but I don’t know what I’m suppose to change or how I’m suppose to access this object in C# to change the property.

image

Thanks

yeah, check this thread out. No C# necessary

Thanks but I just tried:

\servername\Fichiers\Clients\ {client}
And the token has Customer_Name as the Publisher but when I refresh everything, it doesn’t work even if the folder exist on the network. Seems hard to find the problem, any way to alert/print the URL used somewhere?

did you add the file extension? what type of file is it?

You can also build your URL in your BAQ if you want. Then you don’t have to set up the tokens. (well actually you would use only one)

Can you show a screen shot of your URL setup? (you can block out your server information)

This is what I have set up to look at PDF’s

image

I pretty much puth the windows explorer in this so i want it to open a folder. It works great for my base folder but I want to dig deeper into the client folder and then the project folder later.

image

I replaced the {} with [] (guess my vision isn’t perfect :slight_smile: ) and it worked !!!

Thanks a lot, it’s working really great and way easier than I thought

1 Like

I didn’t know if that would matter or not. Guess it does. Learned something new.

Sorry for that, I think I replied too fast and I guess I clicked on the folder by accident. It’s not working :frowning:

do you still have the \ at the end? I don’t think you need that.

I removed it. It works when I update my URL but if I select another project in my dashboard and I refresh the page, the explorer (URL) doesn’t update

I only have one of these looking at a folder, and I have it static like you did. The ones that I have tokens for are looking at URL’s or PDF files. Those ones change and I move from row to row in the grid that’s being published from.

What happens when you hit this refresh? (I should ask which refresh are you hitting?)

I’m hitting the refresh on top and the refresh all button. If I clique on refresh IN the URL tab it just refresh the current folder

Edit: THe only way to make it work is to change the client, open the URL settings, click OK. Now it’s changing. But I don,t want to do that since I don’t have the Panel normally by deploying it :slight_smile:

I’m about where you are now. I haven’t tried specifically what you are doing before, so I haven’t come across a solution.

No problem, it would be nice to have something to make it work. If I was able to refresh the URL in customization in the script editor, it would be probably work since it does take the variable it just doesn’t recognize when to update.

Well let me know if you figure something out. It would be good to know what it takes to do that.

1 Like

Finally, it’s working after deploying the report but when I open the report the first time or when the folder doesn’t exist, I get an error message saying that the folder doesn’t exist (seems like the customer name isn’t loaded at this time)

The folder is located on: path\[client]\[projectID] - [projectDescription].

Is it possible to prevent error messages from this? People don,t want to see error messages if the folder doesn’t exist on the network.

Did you ever figure out if you could suppress this error? I’m about to start a project where I might use this URL window, and how I set things up might be influenced by whether or not I can get rid of this error.

No, I never figured it out unfortunately

1 Like

I found a solution but it’s not perfect (but it works well so far). I create a WebBrowser and I define myself the URL. I need to create the toolbar and the buttons (previous, forward, refresh) manually:

In class Script, initialize this variable:

private WebBrowser browserDisplay = new WebBrowser();`

In InitializeCustomCode(), initialize the Webbrowser:

        EpiBasePanel TrackerPanel = (EpiBasePanel)csm.GetNativeControlReference("9fc6a346-e062-4c54-a790-6e37882f4463-4"); // put your Guid instead
        browserDisplay.Dock = System.Windows.Forms.DockStyle.Bottom;
        browserDisplay.Location = new System.Drawing.Point(0, 40);
        browserDisplay.MinimumSize = new System.Drawing.Size(20, 20);
        browserDisplay.Name = "browserDisplay";
        browserDisplay.Size = new System.Drawing.Size(784, 561);
        browserDisplay.TabIndex = 9999;
        browserDisplay.WebBrowserShortcutsEnabled = false;
        browserDisplay.IsWebBrowserContextMenuEnabled = false;
        browserDisplay.ScriptErrorsSuppressed = true;
        TrackerPanel.Controls.Add(browserDisplay); //TrackerPanel is the name of the Control where you want your file explorer
        browserDisplay.BringToFront();
        /*navigate to a blank page on initialization*/
        string url = @"\\server\Fichiers\Clients\";
        browserDisplay.Navigate(url);

    ToolStrip mainToolBar = new ToolStrip();  
    mainToolBar.Size = new System.Drawing.Size(400, 40);
    Color color = Color.FromArgb(255,88,85,85);
    mainToolBar.BackColor = color;
    //create previous button
    ToolStripButton buttonPrevious = new ToolStripButton();
    buttonPrevious.Image = EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("PickerRemove")];
    buttonPrevious.Click += new System.EventHandler(buttonPrevious_Click);
    //create forward button
    ToolStripButton buttonForward = new ToolStripButton(); 
    buttonForward.Image = EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("PickerAdd")]; 
    buttonForward.Click += new System.EventHandler(buttonForward_Click);
    //create refresh button
    ToolStripButton buttonRefresh = new ToolStripButton();
    buttonRefresh.Image = EpiUIImages.SmallEnabledImages.Images[EpiUIImages.IndexOf("Refresh")];  
    buttonRefresh.Click += new System.EventHandler(buttonRefresh_Click);
    // add buttons to toolbar
    mainToolBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         buttonPrevious,
         buttonForward,
    	 buttonRefresh
    });

TrackerPanel.Controls.Add(mainToolBar);

In whatever event in your code, you can change the URL with this:

string url = @"\\server\Fichiers\Clients\" + customerName + @"\" + projectID + " - " + projectDescription + @"\";
		if(Directory.Exists(url))
		{
			browserDisplay.Navigate(url);
		}
		else
		{
			browserDisplay.Navigate(@"\\server\Fichiers\Clients\");
		}
2 Likes