When creating a control procedure, it is useful to have an overview of all parameters within the template.
I usually go through the following steps:
- Create a object (Task, Subroutine, Function etc..) with parameters
- Create a Control Procedure and Assign the ‘New’ template to the object
-
Generate the definiton, copy-paste all parameters to the template and add following the text at the end of each parameter: ‘-- [empty_line_on_generate]’
Code:
-- PARAMETERS FOR DEVELOPMENT -- [empty_line_on_generate] DECLARE @id AS id -- [empty_line_on_generate] DECLARE @parameter_01 AS text_10 -- [empty_line_on_generate] DECLARE @parameter_02 AS text_1000 -- [empty_line_on_generate] DECLARE @parameter_03 AS date_no_time -- [empty_line_on_generate] DECLARE @parameter_04 AS int -- [empty_line_on_generate] DECLARE @parameter_05 AS amount -- [empty_line_on_generate] DECLARE @parameter_06 AS amount -- [empty_line_on_generate] DECLARE @parameter_07 AS percentage -- [empty_line_on_generate] DECLARE @parameter_09 AS country_id -- [empty_line_on_generate] DECLARE @parameter_10 AS text_255 -- [empty_line_on_generate]
Generate the parameters, empty the value and switch the ‘no_line_when_empty’ option to ON
-
As a result, you always have access to all parameters, which you can give a value to test the code during development.
Like this:
-- PARAMETERS FOR DEVELOPMENT -- [empty_line_on_generate]
DECLARE @id AS id = '1234' -- [empty_line_on_generate]
DECLARE @parameter_01 AS text_10 = 'ABC' -- [empty_line_on_generate]
DECLARE @parameter_02 AS text_1000 = 'ZZZ' -- [empty_line_on_generate]
DECLARE @parameter_03 AS date_no_time = NULL -- [empty_line_on_generate]
DECLARE @parameter_04 AS int = NULL -- [empty_line_on_generate]
DECLARE @parameter_05 AS amount = NULL -- [empty_line_on_generate]
DECLARE @parameter_06 AS amount = NULL -- [empty_line_on_generate]
DECLARE @parameter_07 AS percentage = NULL -- [empty_line_on_generate]
DECLARE @parameter_09 AS country_id = 'NL' -- [empty_line_on_generate]
DECLARE @parameter_10 AS text_255 = 'XXXX' -- [empty_line_on_generate]
INSERT INTO .... ETC..
And you will not have errors when executing the code.
Idea for improvement in SF: Add some code to the ‘Assign’ button to automate step 3 and 4