I want to create a new parameter with Ilogic and calculate the total by applying the existing parameter value.

I want to create a new parameter with Ilogic and calculate the total by applying the existing parameter value.

tkddud711
Advocate Advocate
751 Views
3 Replies
Message 1 of 4

I want to create a new parameter with Ilogic and calculate the total by applying the existing parameter value.

tkddud711
Advocate
Advocate

I want to create a new parameter with Ilogic and calculate the total by applying the existing parameter value.

In the code below, the existing parameter (user parameter) value G_L is not applied. How can I fix the error code?

 

 

oMyParameter = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
oParameter = oMyParameter.AddByExpression("costpermm", "50", UnitsTypeEnum.kUnitlessUnits)
oParameter = oMyParameter.AddByExpression("Cost", "costpermm ", UnitsTypeEnum.kUnitlessUnits)image.png

0 Likes
Accepted solutions (2)
752 Views
3 Replies
Replies (3)
Message 2 of 4

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @tkddud711 

I take it you want something like this? 🙂

Dim oDoc As Document = ThisDoc.Document
Dim oUserParams As UserParameters = oDoc.ComponentDefinition.Parameters.UserParameters
Try
oUserParams("Cost").Expression = "costpermm * G_L/1mm"
Catch
oUserParams.AddByExpression("costpermm", "50", UnitsTypeEnum.kUnitlessUnits)
oUserParams.AddByExpression("Cost", "costpermm * G_L/1mm", UnitsTypeEnum.kUnitlessUnits)
End Try
oDoc.Update
0 Likes
Message 3 of 4

dutt.thakar
Collaborator
Collaborator
Accepted solution

@tkddud711  The legend @JhoelForshav  has already answered it, I have just seen that after posting the reply, so I am editing this. 🙂

 

Try this and see if it works, I assume you already have your parameter G_L created.

 

Dim oParam As UserParameters = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
oParam.AddByExpression("Costpermm", "50" * oParam.Item("G_L").Value, "ul")
oParam.AddByExpression("Cost", "Costpermm", "ul")

 

Hope it helps.

 

If this has answered your question, please accept this as a solution.

 

Regards,

Dutt Thakar

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn
Message 4 of 4

tkddud711
Advocate
Advocate

Great! Thank you!

0 Likes