DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read out the directory of the loaded data in the Data Portal?

Solved!
Go to solution

Hi!

 

I'm writing a script which asks the user where to save an auto generated Report-File. The suggested folder is always G:\TSM:

 

FileNameGet("REPORT", "FileWrite", "G:\TSM\" & Filename & ".TDR" 

 

I want the dialog to suggest the folder where the loaded TDM file is stored, something like "DataFileFolder":

 

FileNameGet("REPORT", "FileWrite"DataFileFolder?! & Filename & ".TDR"

 

Is there a method to get the folder of the loaded data?

 

Regards,

Sascha Zimmer

0 Kudos
Message 1 of 8
(4,638 Views)

Hi Sascha,

every channel in the DIAdem data portal has a property named sourcedatafilepath.

 

For Example:

 

Dim SourcePath
SourcePath = Data.Root.ChannelGroups(1).Channels(1).Properties("sourcedatafilepath").Value
Call FileNameGet("REPORT", "FileWrite", SourcePath & Filename & ".TDR")

Regards,

 

Hans Beckers

0 Kudos
Message 2 of 8
(4,631 Views)

Works perfect! Thanks for your help!

0 Kudos
Message 3 of 8
(4,619 Views)

Hello,

 

after i implemented the code an error occures if i have no data loaded in the data portal.

It says "Index 1 is not an element of the listing" - logically if theres no channel and no group.

 

How can i check if any data is loaded in the portal?

 

Something like

If Data.Root.ChannelGroups(1).Channels(1).Exists = true then...

 

Regards

Sascha Zimmer

 

 

 

0 Kudos
Message 4 of 8
(4,616 Views)

Hi Sascha,

 

you can check the number of channels in the first group:

 

Dim NoOfChannels

NoOfChannels = Data.Root.ChannelGroups(1).Channels.Count

if noOfChannels > 0 then

...

 

Regards

Hans Beckers

0 Kudos
Message 5 of 8
(4,611 Views)

Hi Hans!

 

Thanks for your reply! Your code does the right thing if any data is loaded.I got the same error than before because the Index 1 from ChannelGroups(1) doesnt exist.

My problem is that if there is no data loaded at all, there are also no channels and no channel groups. What can I do to check if the whole Data Portal is empty or not?

 

Regards

Sascha Zimmer

0 Kudos
Message 6 of 8
(4,597 Views)

Hi Sascha,

 

you can count the channelgroups, which are loaded to the data portal:

Dim NoOfChannelGroups

NoOfChannelGroups = data.root.channelgroups.count

If NoOfChannelGroups > 0 then

...

 

Regards

 

Hans Beckers

0 Kudos
Message 7 of 8
(4,595 Views)
Solution
Accepted by Sascha Zimmer

I found a solution by myself:

 

If Data.Root.ChannelGroups.Count > 0 then

...

 

Works fine even theres no ChannelGroup defined.

 

Regards

Sascha Zimmer

0 Kudos
Message 8 of 8
(4,523 Views)