DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Iff Condition based Y channel

Can I able to use condition based channel in report template?

 

X= Time

 

If  "Test_Value"  property value is "Pass", then I want to plot  "P1"channel. For other conditions, want to plot "F1" channel.

Something like below,

 

Y = Iff(Data.Root.ChannelGroups(3).Properties("Test_Value").Value = "Pass", Data.Root.ChannelGroups(3).Channel("P1"), Data.Root.ChannelGroups(3).Channel("F1"))

 

 

Durai26_0-1686835179028.pngDurai26_1-1686835198552.png

Thanks in advance.

0 Kudos
Message 1 of 2
(956 Views)

It is not possible to specify a condition in the layout for the X or Y channel. Nevertheless, you can implement your requirement as follows using an event of REPORT.

 

Step 1: Define an event that will be executed every time REPORT is refreshed.

 

call AddUserCommandToEvent("Report.Events.OnInitializeSheetRefresh", "OnRefreshSheet")

 

Step 2: Implement the event and save it in a file.

sub OnRefreshSheet(Sheet)
  const D2AxisSystem = "2DAxisTemperatur"
  if Sheet.Objects.Exists(D2AxisSystem) and Data.Root.ChannelGroups(4).Properties.Exists("Test_Value") then
    if Data.Root.ChannelGroups(4).Properties("Test_Value").Value = "Pass" then
      Sheet.Objects(D2AxisSystem).Curves2D(1).Shape.YChannel.Reference = "[4]/Temperatur_1"
    else
      Sheet.Objects(D2AxisSystem).Curves2D(1).Shape.YChannel.Reference = "[4]/Temperatur_2"
    end if
  end if
end sub

 

Step 3: The vbs file can be registered via the dialog or via the script command:

call ScriptCmdAdd(CurrentScriptPath & "ReportEvents.vbs")

In the above example code, every time REPORT is refreshed (via F5 or loading the layout), either the Temperature_1 or Temperature_2 channel is displayed if the axis system "2DAxisTemperatur" exists and there is a property at the fourth group named Test_Value.

 

When you save the desktop file (DDD), the information of the registered script file is preserved, so you do not need to perform the third step again. Save your layout after you have performed step 1. The assigned event is then included in it.

0 Kudos
Message 2 of 2
(909 Views)