Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
k_ponomarenko
378 Views, 2 Replies

Creating a multi-valued parameter using ilogic.

Hello.
I have a code that allows you to create and delete a parameter.
But the problem is that when creating a parameter using code, it is created not as a multi-valued parameter, but as a single parameter. At the same time, the program does not issue any errors.
If I understand correctly, the logic of the ArrayList code is broken.
Please help me solve this problem.
Thank you.

'MultiValue.SetList("Capacity_Type", "Container CIP solutions", "Pressure_damping_capacity")
'Capacity_Type = "Container CIP solutions"
Dim oParams As Parameters
Dim oAssemblyDoc As AssemblyDocument = ThisDoc.Document
Dim oAssemblyCompDef As AssemblyComponentDefinition = oAssemblyDoc.ComponentDefinition
Dim oComp As AssemblyComponentDefinition = oAssemblyDoc.ComponentDefinition
oParams = oAssemblyCompDef.Parameters
Dim oUPs As UserParameters = oComp.Parameters.UserParameters
Dim oUP As UserParameter
Dim ParamName As String = "Diameter_of_the_intake_pipe"
Dim List As New ArrayList
	List.Add("80")
	List.Add("100")
	List.Add("125")
	List.Add("150")
	
If Capacity_Type = "Container CIP solutions" Then
	Try
		Test = oUPs.Item(ParamName).Value
	Catch
		oUP = oUPs.AddByExpression(ParamName, List.Item(3), UnitsTypeEnum.kMillimeterLengthUnits)
		Parameter("Container CIP:1", "Diameter_of_the_intake_pipe") = Parameter(ParamName)
	End Try
ElseIf Capacity_Type = "Pressure_damping_capacity" Then
	Try
		oUP = oUPs.Item(ParamName)
		oUP.Delete
	Catch
	End Try
	Parameter("Container CIP:1", "Diameter_of_the_intake_pipe") = False
End If