DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to automate Diadem using VB Script or LabView VIs

I am new to Diadem, but have some experience with LabVIEW.
Basically, I am trying to use LabVIEW to automate DIAdem 9.0 in order to create a daily report that will automatically print out every morning. I have made a VB Script that will do the calculations and format the report - the problem is loading in the new data. How do you make Diadem automatically look in the Citadel database for a specific date?
I found the Load Data VIs, but I'm not sure if you can use those with Citadel because you have to input a specific file path.
I can use a VB Script with STORAGEIMPORT(") to do this manually, but I want the date to update by itself.

Are there VIs that will work or VB code that can accomplish this? (I ca
n use a data acquisition VI to initiate the loading and printing at a scheduled time)
Thanks
0 Kudos
Message 1 of 17
(7,470 Views)
Hi Beth,

You can do this from a VBScript by issuing the command

Call StorageImport(OriginKey)

and if you want the data range to update by itself, you can add that information to the OriginKey XML string. Here's the recipe:

1) Configure your Citadel data storage to have a fixed date-time range (see attached screenshot)

2) Interactively import the channels you want into DIAdem

3) Select one of the channels in the Data Portal

4) Copy the "Origin Key" property value for that channel from the property window of the DataPortal

5) Keep a copy of the "Origin Key" property value for each of the channels you want to import

6) Note the location of the time range embedded in the "Origin Key"
(<start>20000101010000000000000 </start>&
lt;end>20040824165044000000000 </end>)

7) You can now parse in the actual date-time range you want in this location for each of the channels.

😎 Use the Date() and Time() functions in VBScript to return the current date and time values

Sorry it isn't more straightforward,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
0 Kudos
Message 2 of 17
(7,469 Views)
Hey Beth,

One other point on this. If you are always loading data from the same Citadel traces, you can actually roll all those channels into 1 single StorageImport() command, and the easiest way to do that is to turn the VBScript recorder on prior to interactively loading the desired channels. You will then get a similar XML string to the one described above, only it will refer to all the channels at once. You still need to surgically insert the correct date/time condition, as described above, but at least this way you only have to execute one StorageImport() command.

Note that StorageImport() requires DIAdem 9.0 or later.

Cheers,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
0 Kudos
Message 3 of 17
(7,470 Views)
Hi,

it would be great to have an easier option to import from database. What I imagine is something like having a struct where I set all the parameters (which database to get, whicht time to use, what to do with the traces) and then a command which I feed this settings struct to plus the name of the trace to import. Using storage import is quite a hassle (even the time format is a bit strange)...

IMO this would be a nice feature. Importing a few channels for different timeframes just takes quite a while and it's much more convenient to script this.

Cheers,
Carsten
0 Kudos
Message 4 of 17
(7,184 Views)

hi,

 

It's very nice to have some information about how to load data from datastore. but i want to know one more thing, suppose we want to load data from datastore to dataportal through scripting then how to write that script?what is storageABS? IS this any key for loading any of the channel from datastore.

 

Thanks

0 Kudos
Message 5 of 17
(6,474 Views)

Hi,

 

one more thing is when i was loading the data through datastore(when scripting is enabled) The script written is shown below.

 

Option Explicit  'Forces the explicit declaration of all the variables in a script.
Call DataDelAll(1)                      '... HeaderDel
Call StorageImport("<?xml version=""1.0"" encoding=""UTF-16""?><addressgroup version=""1.5""><addresslist><basepoint name=""theStore""><usistore name=""""><type>Citadel5</type><param>&lt;cit5&gt;&lt;alarms&gt;false&lt;/alarms&gt;&lt;db&gt;\\nidhi\c__program_files_national_instruments_labview_8_5_data&lt;/db&gt;&lt;interval enabled=&amp;quot;false&amp;quot;&gt;&lt;delta enabled=&amp;quot;false&amp;quot;&gt;5.0&lt;/delta&gt;&lt;end&gt;20080916092403000000000&lt;/end&gt;&lt;start&gt;20080916082403000000000&lt;/start&gt;&lt;/interval&gt;&lt;quality&gt;false&lt;/quality&gt;&lt;timeout&gt;30&lt;/timeout&gt;&lt;trans enabled=&amp;quot;false&amp;quot;&gt;&lt;brkratio&gt;false&lt;/brkratio&gt;&lt;delta&gt;5.0&lt;/delta&gt;&lt;etm&gt;false&lt;/etm&gt;&lt;interp&gt;false&lt;/interp&gt;&lt;max&gt;false&lt;/max&gt;&lt;mean&gt;false&lt;/mean&gt;&lt;min&gt;false&lt;/min&gt;&lt;mode&gt;Natural&lt;/mode&gt;&lt;qualratio&gt;false&lt;/qualratio&gt;&lt;starts&gt;false&lt;/starts&gt;&lt;stddev&gt;false&lt;/stddev&gt;&lt;stops&gt;false&lt;/stops&gt;&lt;/trans&gt;&lt;waveforms relativeTime=&amp;quot;false&amp;quot;&gt;Mixed&lt;/waveforms&gt;&lt;/cit5&gt;</param></usistore></basepoint><address><basepointref>theStore</basepointref><abskey>USI0b76f6ecddd28bae5751bea1fd497a98c539ea7824f8c9fc93fd17f91ff99ff91ff81ff80ff88ff80ffc9ffd4ffd5ff8bff8fff87ff8bff8aff86ff8eff8aff85ffa6ffe0ffe1ffb1ffbeffbbffaaffadffa5ffb3ffb8ffb1ffbdffa6ffbaffb5ffb6fff0fff1ffa1ffaeffabffbaffbdffb5ffa3ffa8ffa1ffadffb6ffe1ffb4ffc6ffceffd8ff81ff99fffeffd8ffccffd6ff94ff8bff84ff8fff9dffdcffd5ffceffddffd8ffdeffceffc7ffccffc6ffd3ff98ff99ffd0ffd1ffc3ffc2ffc5fff4fffbffe4ffa2ffa7ffefffebfff4ffa9ffcaffc9ffdafffafff6fff9fff9ffd3ffcdffd2ffd3ffdbfff8ffe6ffeffff5ffe7ffe8ffdbffc5ffebffedffe5ff0cff21ff33ff1dff0fff13ff16ff16ff16ff1aff2aff3dff1dff01ff05ff02ff1aff03ff08ff02ff1fff19ff36ff24ff06ff04ff33ff2dff26ff35ff3eff58ff00ff6bff02ff38ff3aff2eff38ff04ff19ff3fff31ff3cff3aff0eff33ff38ff2aff22ff6dff2dff27ff2bff3bff25ff67ff2aff2cff26ff1fff2aff24ff21ff4bff1eff5bff50ff4eff42ff05ff17ff42ff44ff
59ff0aff0fff1dff45ff42ff4eff4dff48ff47ff4eff53ff17ff14ff08ff4bff40ff45ff50ff57ff53ff45ff72ff7bff73ff68ff70ff7fff60ff26ff2bff62ff6cff64ff76ff2cff75ff71ff7bff6fff31ff23ff7fff73ff79ff6dff39ff3aff2aff67ff6bff63ff6fff6efe9afe92fe96fe99fe82fec4fec5fed7fe9cfe93fe8cfeca</abskey></address></addresslist></addressgroup>","") '... StorageABS,ImportAction
Call StorageImport("<?xml version=""1.0"" encoding=""UTF-16""?><addressgroup version=""1.5""><addresslist><basepoint name=""theStore""><usistore name=""""><type>Citadel5</type><param>&lt;cit5&gt;&lt;alarms&gt;false&lt;/alarms&gt;&lt;db&gt;\\nidhi\c__program_files_national_instruments_labview_8_5_data&lt;/db&gt;&lt;interval enabled=&amp;quot;false&amp;quot;&gt;&lt;delta enabled=&amp;quot;false&amp;quot;&gt;5.0&lt;/delta&gt;&lt;end&gt;20080916092403000000000&lt;/end&gt;&lt;start&gt;20080916082403000000000&lt;/start&gt;&lt;/interval&gt;&lt;quality&gt;false&lt;/quality&gt;&lt;timeout&gt;30&lt;/timeout&gt;&lt;trans enabled=&amp;quot;false&amp;quot;&gt;&lt;brkratio&gt;false&lt;/brkratio&gt;&lt;delta&gt;5.0&lt;/delta&gt;&lt;etm&gt;false&lt;/etm&gt;&lt;interp&gt;false&lt;/interp&gt;&lt;max&gt;false&lt;/max&gt;&lt;mean&gt;false&lt;/mean&gt;&lt;min&gt;false&lt;/min&gt;&lt;mode&gt;Natural&lt;/mode&gt;&lt;qualratio&gt;false&lt;/qualratio&gt;&lt;starts&gt;false&lt;/starts&gt;&lt;stddev&gt;false&lt;/stddev&gt;&lt;stops&gt;false&lt;/stops&gt;&lt;/trans&gt;&lt;waveforms relativeTime=&amp;quot;false&amp;quot;&gt;Mixed&lt;/waveforms&gt;&lt;/cit5&gt;</param></usistore></basepoint><address><basepointref>theStore</basepointref><abskey>USI0b76f6ecddd28bae5751bea1fd497a98c539ea7824f8c9fc93fd17f9fff94ff91ff9cff9bff9fff89ff86ff8fff87ff9cffc5ffd8ffd9ff89ff86ff83ff92ff95ffadffbbffb0ffb9ffb5ffaeffb2ffbdffaeffe8ffe9ffb9ffb6ffb3ffa2ffa5ffbdffabffa0ffa9ffa5ffbeffe9ffbcffbeffb6ffa0fff9ffe1ff86ffa0ffb4ffdeff9cff83ff8cff87ff95ffd4ffddffd6ffc5ffc0ffc6ffd6ffdfffd4ffdeffdbff90ff91ffd8ffd9ffcbffcaffcdffccffc3ffdcff9aff9fffd7ffd3ffccffa1ffc2ffc1ffd2fff2fffefff1fff1ffcbffd5ffcaffcbffc3ffe0fffefff7fffdffefffe0ffd3ffcdffe3ffe5ffedfff4ffd9ffcbffe5fff7ffebffeeffeeff1eff12ff22ff35ff15ff09ff0dff0aff02ff1bff10ff1aff07ff01ff2eff3cff0eff0cff3bff25ff2eff3dff36ff50ff38ff53ff3aff00ff02ff16ff00ff3cff11ff37ff39ff34ff32ff06ff3bff30ff32ff3aff75ff35ff3fff33ff23ff3dff6fff22ff24ff2eff17ff22ff2cff29ff33ff66ff31ff36ff22ff2cff32ff26ff5aff4cff1dff5fff54ff5fff5fff5eff5eff0aff
1aff41ff41ff5eff0fff0cff00ff5aff5fff4dff48ff4fff42ff4dff5eff18ff19ff0bff4eff47ff40ff53ff6aff6cff78ff71ff7eff74ff6dff73ff72ff6fff2bff28ff3cff79ff74ff69ff31</abskey></address></addresslist></addressgroup>","") '... StorageABS,ImportAction

Now when i tried to run this script it's giving error "string variable is unterminated" so what to do for that?

 

Thanks

0 Kudos
Message 6 of 17
(6,469 Views)

Hi,

 

This occurs because the XML string the VBScript recorder records is too long for VBScript to have on one command line.  You have to break up that long line into multiple lines with either the "_" operator or with an approach like this:

 

XML = "lkhsgadfglkasligasfg"

XML = XML & "KJSHGDFKJHDSFKHJ"

  :           :            :

 

See my other post to you today for an alternative and more parametric programmatic load option.

 

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 7 of 17
(6,457 Views)

Hi,

 

Thanks for all your help, i did according to you,i made seperation b/w the lines according to you, but while running that script DIAdem is loading  same data which is there in the data portal,even if we change the values for different data then also it's showing same behaviour.it is loading same data in portal which is loaded just before the script run. 

 

Thanks 

0 Kudos
Message 8 of 17
(6,446 Views)

Hi ,

 

I tried according to what you told,i tried to seperate the line by "_" operator, after doing that it's giving error "unable to import all channels in data store" . it's not importing the data into the portal, so what should i do for that? now i am tring to import values of only one variable through citadel database. i am sending attatchment of script. can you please answer me what's the problem?

 

Thanks 

Download All
0 Kudos
Message 9 of 17
(6,431 Views)

Hi 8,

 

You raised two issues in this last post.  DIAdem loads a data set with 4 groups by default into the Data Portal.  You can change this behavior by choosing the following menu: "Settings>>Options>>NAVIGATOR" and removing the default file path in that dialog.  You then need to choose the following menu: "Settings>>OPtions>>Save as" in order to save this setting change into your Desktop.DDD file, so that the next time you launch DIAdem it will remember this change.

 

The other issue you mentioned was that you were unable to load all the data programmatically from the Citadel data base.  How many channels were you attempting to load?  What happens when you try the same thing with a program that jjust loads one channel from Citadel?

 

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 10 of 17
(6,426 Views)