Sunday, February 10, 2013

PrmCount()

It goes without saying that if you employ ExecFunction() statements in your code you are going to pass parameters.  Knowing that the parameters you expect were passed becomes important and so is the PrmCount().

Not only will it check and ensure the correct number of parameters were passed, it can be used to create stems of programming logic based off that value as well.

Usually this was something I wrapped in a Case statement.  for example:

:BEGINCASE;
     :CASE PrmCount() = 1;

     :CASE PrmCount() = 2

etc., etc.

This let me count the number of parameters passed and perform logic based on that number.  Very useful to catch errors and make sure you are using the correct passed values.

The order, by the way, is the same order you declared the parameters.  So, if PrmCount() = 1 then it matches the first parameter declared after the :PARAMETERS label.

No comments:

Post a Comment