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

iLogic skip line if iProperty doesn't exist

I'm developing a universal code to use in all my part templates that will calculate the labour costs of the part. Part of the rule needs to search through the custom iProperties and find unique operational codes that have timing values inside them and use those values to calculate the cost. Here is a snippet of the code I have so far:

 

'Calculate glass labour cost
        If iProperties.Value("Custom", "GLASS_SET") > 0 Then
            glass_labour_set = (iProperties.Value("Custom", "GLASS_SET")/60)*glass_labour_rate
            glass_labour_run = (iProperties.Value("Custom", "GLASS_RUN")/60)*glass_labour_rate
        End If
        
'Calculate sheet metal labour cost
        If iProperties.Value("Custom", "PUNCH_SET") > 0 Then
            punch_labour_set = (iProperties.Value("Custom", "PUNCH_SET")/60)*punch_labour_rate
            punch_labour_run = (iProperties.Value("Custom", "PUNCH_RUN")/60)*punch_labour_rate
        End If

 How can I get the code to skip an IF statement if the iProperty doesn't exist? For example when the rule runs in a glass part, it throws up an error and says it cannot find a property names "PUNCH_SET" because the glass part only has GLASS_RUN and GLASS_SET in it.

 

Any help would be much appreciated!