Help With A Custom Statement

I hope someone can help me with a custom statement. I have written a statement with two parameters. I would like to make the second parameter optional, so I can just leave it off the statement when I use it. However, if I do that, I now get an error message saying it needs two parameters.
How can I do that?

Add the word OPTIONAL to the description of your second parameter. For example, this was copied from the POST custom statement.

<parameter NAME=DATAVALUE2 OPTIONAL TYPE=TEXT>Optional second value to be posted.<br>You may post as many data values to as many fields as you wish. They will all be posted to the same record.</parameter>

That will get it to compile without a second parameter. Then, when you go to read that parameter, use some form of error trapping so that you don’t get an error for trying to read a parameter that doesn’t exist.

Thank you.