Navigation - Write Window and parameters to Client Tag Dataset

Please bare with me, as i’m pretty new to Ignition.
I have a project that consists of a tabstrip type navigation, with 4 tabs that swap to 4 different windows, and a back and forward button next to the tabs. One of these windows (3) has objects that when clicked on, pass tagpaths and facilityname parameters to a window with more details (e.g motor details window). This populates this window with the correct data.
The back button has “system.nav.goBack()” on mouseClicked.

If i:

  1. Click on a tab-3
  2. Click on the 1st motor object (swaps to detail window with tagpath and facilityname of 1st motor)
  3. Click on another tab;

When I hit back 2 times, it goes back to the motor details window with the correct parameters, then back to the starting window. This works as it should.

Where i’m having an issue is that If I:

  1. Click on a tab-3
  2. Click on 1st motor object
  3. Click on tab-3
  4. Click on 2nd motor object
  5. Then click on another tab

When I hit back 4 times:

  1. I go back to the 2nd motor details page with the correct parameters passed
  2. I go back to tab-3
  3. The detail page that loads is with the passes parameters of the 2nd motor (should be first)
  4. Back to Tab-3

I tried this variation clicking through all 9 motors then another tab, then hit back all the way to the start; and the motor detail pages that come up are all from the last motor (9) that was viewed. It’s like the different parameters that were passed aren’t being saved except for the last one, so eveYr detail page uses that parameter.

This doesn’t work for the way we need the navigation to work, so I’m thinking i’m going to have to keep track of the windows that are opened/swaped to (and the passed parameters), then have the back button read through where i have them saved and load it.

I had an idea to use a Client Tag as a dataset with 3 columns (Window, Tagpath, facilityname). Each click of a tab or an object that opens the detail window with it’s parameters, it would add a row to the dataset then populate the entry for each column. I have the Client Tag created and created the 3 columns in it. Each column (Folder) currently has an entry “Row 0”.

I’ve followed an example from another post, to write to a dataset, but it’s for one column. When I try it i get an error that:

Traceback (most recent call last):

File <‘event:mouseClicked’>, line 12, in <‘module’>

IndexError: Number of values (1) doesn’t match number of columns (3) in dataset.

What I have in each tab and Object that opens/swaps a window:

param1 = event.source.parent.SiteName
param2 = event.source.parent.tagPath

recentWindows = system.tag.read("[Client]TestRecentWindows").value
old = system.tag.read("[System]Client/User/CurrentWindow").value
AllValue = [param2, param1, old]
system.tag.write("[Client]TestRecentWindows", system.dataset.addRow(recentWindows, [AllValue]))

Any idea how i have to format the system.tag.write? THanks.

To explain the first behavior, system.nav.goBack() does not pass parameters to the window. Since you are using a parameterized pop-up it is displaying the pop up with the most recent tag values displayed. This is the expected behavior and so as you have concluded will not work exactly for your purposes.

The second problem is this, you defined AllValue as a list, then in the function call you place the list AllValue within a list.

So while you thought you were making this function call:

system.dataset.addRow(recentWindows,[param2,param1,old])

You were actually making this function call:

system.dataset.addRow(recentWindows,[[param2,param1,old]])

remove the sqaure brackets from around AllValue in your last line and I think your error should clear up.

Also, you may see unexpected behavior here because system.tag.write is an asynchronous function and the tag write is actually executed on another thread separate from the GUI. So you may see your pop-up with the previous tag values and some time later those values change.