Hello All,
Need some help to get off on the right foot.
I am writing some code that requires me to run PART of the code only if a certain value is present.
Example
If Parameter("Test") < 20 Then
BLAH BLAH BLAH
BLAH BLAH BLAH
BLAH BLAH BLAH
End If
The BLAH BLAH BLAH bit only needs to run if the Statement at the start is true i.e Parameter("Test") < 20
If it is not I want the code to skip it.
I tried to seperate the code into 2 rules
Example
If Parameter("Test") < 20 Then
iLogicVb.RunRule("Whatever")
End If
But that doesn't seem to work unless I'm missing something as the edited parameters are updating anyway.
What keywords/Statements can I use to achieve this? Case....Sub?
Many Thanks
Tim
What you have written should be working unless the parameter in question is not located where the code that is running it happens to reside.
Try the code below with the text replaced with your parameter name.
If Parameter("ParameterNameHere") < 20 Then MessageBox.Show("True") Else MessageBox.Show("False") End If
Or if the parameter is local along with the rule, you could write it as :
If ParameterNameHere < 20 Then MessageBox.Show("True") Else MessageBox.Show("False") End If
Perhaps simply seeing which 'state' your parameter is in (using those message boxes as a poor man's debugger) will help you see a problem with the math or something else. If you require further help, please post your entire code block or even a zip file of the files in question.