DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

VBScript continue on new line syntax

Hello there,

As I'm a DIAdem script beginner, I've created a script using the recorder mode, but need to add additional channels to be subracted and to avoid the line becoming to long, want to continue the command on the next line.

Can't seem to find anything referring to multiline syntax in the DIAdem script help - searched the web and found that normal vbscript uses '&_ ' but doesn't seem to work.

Anybody help ?

Regards

AdeK

0 Kudos
Message 1 of 4
(22,944 Views)

Hello AdeK!

 

Just the _ does the job. The &_ is used if you have a long string and want concat it on multiple lines. No different syntax! & for the string concat _ for the new line!

 

Matthias

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

Hi Matthias,

Tried it and get the warning 'unterminated string constant' after I try running the code, the script screen shows a red squiggle after the _ character in the line code.

Must be doing something else wrong, but note I have to add another 120 channels to this sum ! (I realise there will be a much easier way using some sort of FOR NEXT loop), but I'm just a beginner !

 

here's the code

ChnCalculate("Ch(""Load Comparison"")=Ch(""Alt Amps"")-(Ch(""Main A"")_

+ch(""Starter A"")+Ch(""DF_1_FUEL_SENS1""))") '... FormulaTxt

 

Regards

 

Adrian

0 Kudos
Message 3 of 4
(22,941 Views)

Hello AdeK!

 

You want to spread a string on multiple line than you have to close the string, add a closing ", add a & to concat the two strings and a starting " in the new line.

 

ChnCalculate("Ch(""Load Comparison"")=Ch(""Alt Amps"")-(Ch(""Main A"")" & _

"+ch(""Starter A"")+Ch(""DF_1_FUEL_SENS1""))") '... FormulaTxt

Conclusion: You have to split the string into two parts, concat them and then you can use the _ to put them on two lines.

 

Matthias

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