DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Select a list of data

Hello,

 

I need to print out a list of acquisition data in a report.

I have a for loop in which every iteration I want to read one data, update the report and then print the report.

 

Question: How I can select these data which format is a string like

MP1

MP2

MP3

Is it possible to define a varaible that is a sum of a string radix (MP) and a number (1) which encrease each iteration of the loop?

 

Thanks

Marco

 

 

Message 1 of 4
(4,295 Views)

Hello Marco!

 

You can build a string out of another string and an integer in VBS just with a + operator or better the & operator: Have a look at this example:

Option Explicit

Dim i
Dim Filename

For i=1 To 3
  Filename = "MP" & i & ".tdm"

  Call DataFileLoad(Filename,"TDM","Load")
Next

Hope this helps

 

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 4
(4,293 Views)

Thank you Matthias,

I still have problem in defining the folder from which the data are loaded.

 

Should I define another variable before the for loop?

 

How can I set the path in the following command?

Call DataFileLoad(Filename,"TDM","Load")

 

Best regards

Marco Milan

0 Kudos
Message 3 of 4
(4,268 Views)

Hello Marco!

 

Two possible solutions. You can change the DIAdem variable DataDrvUser and set it to your path or you can use a variable in the code and use a full qualified filename (what I would prefer). This is the code:

Option Explicit

Dim i
Dim Filename
Dim Path

Path = "C:\MyData\"

For i=1 To 3
  Filename = Path & "MP" & i & ".tdm"

  Call DataFileLoad(Filename,"TDM","Load")
Next

Matthias

Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 4 of 4
(4,265 Views)