From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculation using the number of Values in a Channel

I am looking to figure out if there is a way to define the total number of rows in a channel and then add the total number of rows to another, / that by another length and then * by 100 ?

 

C1 = Data.Root.ChannelGroups(1).Channels("Call_Start_Month[Offered]").Properties("length").Value
C2 = Data.Root.ChannelGroups(1).Channels("Call_Start_Month[Handled]").Properties("length").Value
C3 = Data.Root.ChannelGroups(1).Channels("INW<.30_By_Month").Properties("length").Value


Call Calculate(Total answered = C3/(C1-C2)*100,null,null,"%")

 

Is there a way to do this ?

0 Kudos
Message 1 of 4
(4,947 Views)

Hi J,

 

Where do you want the result(s) to go?  It looks like you get one scalar results, in which case you don't need the Calculate() command, given the code you already posted.  Replace the Calculate() command with this:

 

ResultPct = 100*C3/(C1-C2)

MsgBox ResultPct

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 4
(4,926 Views)

What I am trying to do is calculate the % of calls answered compared to offered, under 30 seconds.(Month over month).

 

I want to graph(x) month and (y)% of calls answered under 30 sec

 

Here is what I am doing and playing with, I have added the attachements that I am working with. 

 

 

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

Hi J,


That's a long script.  When I ran it, it threw an error at about line 340 where you're calculating the call times from the string channel that you get from the Excel file.  I edited your script at that spot to calculate the elapsed seconds with the TTR() command in the Channel Calculator, which runs way faster than a VBScript loop over all the channel values:

 

  'Separates Time for Ques
Dim CH_QT_MIN, CH_QT_TOT
IF Data.Root.ChannelGroups(1).Channels.Exists("Queue_Time") Then
  SET CH_source = Data.Root.ChannelGroups(1).Channels("Queue_Time")
  Set CH_QT_TOT = Data.Root.ChannelGroups(1).Channels.Add("Queue_Time_Total_Calculated",DataTypeFloat64)
  L1 = CH_source.Properties("Number").Value
  L2 = CH_QT_TOT.Properties("Number").Value
  Call Calculate("Ch(L2) = TTR(Ch(L1))")
End If 

 

So now the script runs all the way through and creates the report.  Now what?

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

 

0 Kudos
Message 4 of 4
(4,898 Views)