iLogic Tutorial for the iDoor Three – 10

iLogic Tutorial Three – Writing the iLogic Code

The code for this feature is pretty simple. You modeled five edge profiles, and you created a Multi-Value iLogic Parameter that lists five options as well as a None option. You now need to link the Parameters to the features. Starting with the first line:

If Edge = “None” Then

What we are doing with this first line of code is telling the program that If the iLogic Parameter named Edge is equal to (the little multi-value button is set to) the value “None”, which was the first value we added when we created the multi value list, Then do whatever follows:

Feature.IsActive(“Edge_Profile_A”) = False
Feature.IsActive(“Edge_Profile_B”) = False
Feature.IsActive(“Edge_Profile_C”) = False
Feature.IsActive(“Edge_Profile_D”) = False
Feature.IsActive(“Edge_Profile_E”) = False

This code is telling the program that it is False that any of the edge profile features are active –which will leave all of them suppressed. It does not say what to do if the value is set to anything other than None, and would need to be told to end with the End If statement to be valid. We could do just that, and write separate rules for each profile, but it will be a lot easier to keep them all in one rule –so we will continue onto the next value with the ElseIf statement, and tell the program what to do if the Edge parameter value is set to Profile A:

ElseIf Edge = “Profile AThen
Feature.IsActive(“Edge_Profile_A“) = True
Feature.IsActive(“Edge_Profile_B“) = False
Feature.IsActive(“Edge_Profile_C“) = False
Feature.IsActive(“Edge_Profile_D“) = False
Feature.IsActive(“Edge_Profile_E“) = False

This code, as well as after it, would be ignored if the first argument were satisfied i.e. the value was set to None. If the program found the multi-value setting set to Profile A, then it would carry out the instructions above to suppress all but Edge_Profile_A. If the setting were at Edge_Profile_E, it would simply pass over all of the code until it found instructions for that value. If it finds none, it does nothing.

Rule E. The code below shows what separate rules would look like. You would need one for each value of the Edge parameter, or six of them. If this were the only one present, none of the values in the multi-value list would do anything until you got to the Profile E value, which would fire the code below and unsuppressed Edge_Profile_E. Once fired the first time, you would be stuck with Edge_Profile_E. Try it once.

If Edge = “Profile EThen
Feature.IsActive(“Edge_Profile_A“) = False
Feature.IsActive(“Edge_Profile_B“) = False
Feature.IsActive(“Edge_Profile_C“) = False
Feature.IsActive(“Edge_Profile_D“) = False
Feature.IsActive(“Edge_Profile_E“) = True
End If

The full code is here: Profile_Code.txt –if you are having any problems during testing, the first place to look is the spelling. “None” is not the same as “none“, all code is case sensitive. Missing underscores and spaces where they shouldn’t be is also common.

If this iLogic tutorial has helped you at all, please consider linking from your home page, blog, or in discussion groups to spread the word. Thanks!

Logic Tutorial Three Navigation –