Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to be able to set a value to a variable XXXX in 4 instances, activating which one in a Case Select statement. Essentially if 1 out of 4 of the cases is true it will assign that number as the variable to be used later in the code. The hope being that only one of the 4 cases would activate allowing my code to be much simpler. I Will post my example code below. I just need to know if it is possible to do this? Thank you.
Select Case True Case StackLightOptions = "NO STACK LIGHT" AndAlso HMIOptions = "BR HMI" Components.Delete("A10000932:1") Components.Delete("A10000117:1") Components.Delete("A10000929:1") XXXX = ("A10000817:1") Case StackLightOptions = "STACK LIGHT" AndAlso HMIOptions = "BR HMI" Components.Delete("A10000817:1") Components.Delete("A10000117:1") Components.Delete("A10000929:1") XXXX = ("A10000932:1") Case StackLightOptions = "NO STACK LIGHT" AndAlso HMIOptions = "STANDARD AB HMI" Components.Delete("A10000932:1") Components.Delete("A10000817:1") Components.Delete("A10000117:1") XXXX = ("A10000929:1") Case StackLightOptions = "STACK LIGHT" AndAlso HMIOptions = "STANDARD AB HMI" Components.Delete("A10000932:1") Components.Delete("A10000817:1") Components.Delete("A10000929:1") XXXX = ("A10000117:1") End Select If HMILocation = "CENTER" Then Components.Delete("A10001125:1") Components.Delete("A10001125:2") Constraints.AddMate("Mate1", "A10001124:1", "WorkAxis1", "XXXX", "WorkAxis1", offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference, solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType, biasPoint1 := Nothing, biasPoint2 := Nothing) Constraints.AddMate("Mate2", "A10001124:1", "WorkAxis2", "XXXX", "WorkAxis2", offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference, solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType, biasPoint1 := Nothing, biasPoint2 := Nothing) End If If HMILocation = "LEFT" Then Components.Delete("A10001124:1") Components.Delete("A10001125:2") Constraints.AddMate("Mate1", "A10001125:1", "WorkAxis1", "XXXX", "WorkAxis1", offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference, solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType, biasPoint1 := Nothing, biasPoint2 := Nothing) Constraints.AddMate("Mate2", "A10001125:1", "WorkAxis2", "XXXX", "WorkAxis2", offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference, solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType, biasPoint1 := Nothing, biasPoint2 := Nothing) End If If HMILocation = "RIGHT" Then Components.Delete("A10001124:1") Components.Delete("A10001125:1") Constraints.AddMate("Mate1", "A10001125:2", "WorkAxis1", "XXXX", "WorkAxis1", offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference, solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType, biasPoint1 := Nothing, biasPoint2 := Nothing) Constraints.AddMate("Mate2", "A10001125:2", "WorkAxis2", "XXXX", "WorkAxis2", offset := 0.0, e1InferredType := InferredTypeEnum.kNoInference, e2InferredType := InferredTypeEnum.kNoInference, solutionType := MateConstraintSolutionTypeEnum.kNoSolutionType, biasPoint1 := Nothing, biasPoint2 := Nothing) End If
Solved! Go to Solution.