06-22-2016 06:02 PM
We have multiple databases that are setup differently. I need to handle data being loaded, and I am using the load events (OnLoading, and OnLoaded), but I don't quite know how to tell which database the data is coming from. Any suggestions?
06-23-2016 06:06 AM
You can use
Navigator.Display.CurrDataStore.Name
in case you have registered your DataStore to DIAdem - such known by name.
In case you connected the DataStore by parameter, you can use:
Dim tempDataStore : Set tempDataStore = Navigator.Display.CurrDataStore.GetDataStore()
MsgBox tempDataStore.Parameters
Set tempDataStore = Nothing
(You can get that same parameters for registered DataStores using : Navigator.Settings.RegisteredDataStores(Name).Parameter)
06-24-2016 04:51 PM
Hi Russell,
If you're loading data from a data base, why aren't you issuing SQL queries to retrieve the desired records and add them as new channels in the Data Portal? In that case you don't need a load event.
Are you really dragging and dropping data from a data base or using a DataPlugin with DataFileLoad() to load data from a data base?!
Brad Turpin
DIAdem Product Support Engineer
National Instruments
06-24-2016 07:17 PM
I'm using Navigator.LoadData to get the data from the ASAM datastore. I've never tried to use SQL queries...
here were a couple things that lead me to use the events, first was that I wanted properties to load consistently, regardless of how they are loaded, ie, through the simple GUI I created, through the Navigator GUI, or if I call the LoadData method. Second, and bigger reason, there were some properties that needed to be imported across database levels. For example, there is a key that ends up at the root level when loading data with loading configurations, so I use the events to move this key to the group level. There are a couple of other things like this.
Does this seem like a valid reason?
06-27-2016 02:45 AM
If you combine
Navigator.Events.OnDataStoreLoading
with
Navigator.Events.OnInteractionLoading Navigator.Events.OnInteractionLoaded
you can determine if the load command was done by Navigator or your script.
So if you set
navigator.Display.CurrDataStore.GetDataStore
to a global variable in OnInteractionLoading and set it back to nothing on OnInteractionLoaded you will be able to fuígure out which store belongs to your elements.
06-27-2016 05:06 PM
Hi Russel,
Never mind. An ASAM-ODS database uses a completely different API from an open SQL database. You definitely want to use the ASAM-ODS (AOP5) DataPlugin to read data from that. You can even use the query tools and advanced tree view browsing tools in the NAVIGATOR, which are NOT available for open SQL databases.
I'll leave you in Andreas' capable hands,
Brad Turpin
DIAdem Product Support Engineer
National Instruments