User Tools

Site Tools


topic_functionbuilder

Function Builder

fData functions are an important part of fSeries as they are used to create new data, get values from within fSeries and make choices. For example:

  • To calculate a person's age when their data of birth is in the data source but you want to show their age
  • To get today's date for comparison in a query
  • To get settings from fSeries (including your custom settings)
  • To make decisions within an fDocs template as to whether to include a section or not
  • To count the number of rows in a data group

Available Functions (Right Panel)

There are many different functions available. When you open the Function Builder, a list of available functions is shown to the right. This may not be the full list for the top level function if, for example the context of the function calls for a true/false value to be returned.

User the filter buttons at the top to narrow down the search for a function based on its type or usage.

If you start to type the name of a function in the entries to the left, the function list will move to the first that matches your entry. When it gets to an exact match the functions full details will be shown.

If you click on a function in the list to the right, its details will be opened to view and it will be inserted in the entry you were focused on.

Function Entry (Left Panel)

Enter your function on the left side.

You can enter/paste a full text function in the entry box and the function will be expanded to show its structure and available parameters. In the example above the Age is being calculated, using the Age function which takes one or two parameters: From Date and To Date (assumed to be today if not entered).

As with most function parameters, these too may be functions, so the From Date uses a Value function to get the Date Of Birth field from the People data group. When executed, the Date of Birth from the current row being processed will be used to calculate the Age, which will be added to the row. Note that for some functions such as Value, select lists are provided as prompts for the possible options.

Complex Parameters

Some functions have complex parameters such as lists of parameters or groups of parameters. A good example is the Case function, which has the following parameters:

  • select - the value to compare values with
  • default - the value to return if no matches are found
  • any number of pairs of value/return

Each of the value/return pairs is checked in turn and the first value found to match is the one whose return value is returned. So the sequence of the value/return pairs is important and there is an open ended number of parameters

Enter the parameter values (or further functions) as required. Click the plus icon at the bottom of the value/return pairs list to add another pair. Use the grab handle at the top left of each pair to drag them into the correct sequence. Use the trash icon to the right of each pair to remove it.

Copy / Paste

At the top of each function, a text version of the function is shown. To the right is a copy/paste icon. Click it to put a copy of the text into your clipboard.

This is useful if you want to take part or all of your function and use it elsewhere. Simply paste the text version into a function entry.

Literal Values

Some parameters have “literal” values, i.e. an actual text value rather than a further function. Generally you can just enter the value directly, but if the text is the same as one of the function names, surround it with double quotes, e.g. “Date”. This will tell the function builder to take it as the actual value rather than the function.

Apply

When your function is ready, click Apply (at the top of the page) for the function to be returned to the calling page and applied.