In this recipe, we will get familiar with a Smart Editor tool available in Designer to help you write your scripts or functions in a convenient way.
We will create a new function that can be executed either within a script or within a dataflow. This function accepts two parameters: date value and number of days. It then adds the number of days to the input date and returns the result date.
Open Designer and go to Tools | Custom Functions… from the top level menu:
In the opened window, right-click in the area with the list of functions and choose New….
Choose the name of the new
fn_add_days
function and populate the description section, as shown in this screenshot:Then, click on Next to open a Smart Editor window and input the following code:
try begin $l_Date = to_date($p_InputDate,'DD/MM/YYYY'); $l_Days = num_to_interval($p_InputDays,'D'); end catch ( all ) begin print('fn_add_days() FAILED : check input parameters'); raise_exception...