SRXP's **SmartStrings** Guide

Use SmartStrings to build complex export formats within SRXP.

As no company is a-like, we've built a feature called SmartString which help clients to make complex exports possible. It allows for IF statements to be incorporated into all export formats or convert data into any desired format. Please note that this feature is meant for administrator users of SRXP with a little bit of experience with our Exports.

The name SmartStrings refers to a smart and custom friendly  'String'. A String is a term often used for in programming languages to state that something is of type Text. It can also be understood as a sequence of characters that together form a Text. In this case, we made this String/Text smart. Using it allows for anyone without any coding experience to build complex exports.

One could compare it with the Excel Functions we already support in the CSV 2.0. export format but these only work on Excel/CSV like export formats and really depend on what is exported in some column. 

Let's see how to use the SmartString feature to make complex exports. We do this by handling different scenarios which could closely resemble your specific use case for this feature.

Using Filter

The SmartString contains a hidden feature called filters. Filters can be seen as output changers, they can convert the result of some output. They are triggered by the pipe character: |

{{ report.account.free_1|upper }}

This will convert any output of the first part (report.account.free_1) to be converted into all caps.

The available filters are: 

  • date - allows for formatting of dates.

{{ report.submit_date |date('d/m/Y') }} => '10-02-2022'
{{report.submit_date|date('d/M/Y')}} => '10-Feb-2022'
{{report.submit_date|date('d/m/y')}} => '10-02-22'
// Pro tip, output the current date with 'now':
{{ 'now' |date('d/m/Y') }} => '31-01-2022'

  • date_modify

{{ report.submit_date|date_modify('+1 day')|date('d/m/Y') }} => '31-01-2022'

  • number_format - allows for formatting the separators

{{ 38100.333|number_format(2, ',', '.') }} => 38.100,33

The first ',' is the decimal separator, the second '.' is the thousand separator.  In this way you can support any number format that your financial system requires.

  • upper - Will convert any text to all caps.
  • lower - Will convert any text to lower case.
  • join - Will convert a list into text.
  • first - Outputs the first character of the input text.
  • last - Outputs the last character of the input text.
  • capitalize - Will convert the first character of every sentence into capitalized text, such that is nicely readable.
  • length -  Outputs the length of any text.

{{ string [start:length] }} => 'output'
{{ '12345' [0:3] }} => '123'
{{ '12345' [1:4] }} => '2345'

  • slice - Extracts a portion of a sequence, mapping or string. 
  • reverse - Reverses the input text.
  • title - Make a title representation of given text.
  • trim - Can trim any character from the start of end of input text.

{{ '  An expense description.  '|trim }} => 'An expense description.'
{{ '  An expense description.'|trim('.') }} => '  An expense description.'
{{ '  An expense description.  '|trim(side='left') }} => outputs 'An expense description.  '
{{ '  An expense description.  '|trim(' ', 'right') }} => '  An expense description.' }

  • merge - Merges an array
  • default - Can provide a default value if the current value is not found or defined.

Very useful for when a there is no payment method on the expense (which is the case for mileages, duties and timesheets).

{{ expense.payment_method.code |default('1234') }} => '1234' }

  • export_currency - Will convert an amount to export currency using the exchange of the expense. Make note that you can only use this on an expense level, as the exchange rate is per expense and not per report.

{{ amount.amount |export_currency }}

  • inc_vat - Will show the expense amount including VAT. The amount will be shown excluding VAT as default. You can't use this string for the report title. 

{{ amount.amount |inc_vat }}

The list of test operators

In this Section we will provide information about the different operators we support in the SmartStrings feature

checks if A and B are equal

  • ==         

{{ 'A' == 'B' ? 'true' : 'false'}} => 'false'

checks if A and B are equal

  • is

{{ 'A' is 'B' ? 'true' : 'false'}} => 'false'

Reverses the result of B

  • not

{{ 'A' is not 'B' ? 'YES' : 'NO'}} ==> 'Yes'

Checks is A is smaller than B - only works for numeric values.

  • <

{{ '1' < '2'? 'smaller' : 'greater'}} => 'true'

Checks is A is greater than B - only works for numeric values.

  • >

{{ '1' > '2' ? 'greater' : 'smaller'}} => 'false'

Checks is A in B

  • in

{{ 'A' in 'B' ? 'YES' : 'NO'}}

This can work for example, when is A = 1 and B = [1,2,3]

{{ '1' in '1,2,3' ? 'true' : 'false'}} => true

{{'abc' in 'abcd' ? 'true' : 'false'}} => true

{{ 'z' in 'abcd' ? 'true' : 'false'}} => false

Checks starts A with ...

  • starts with

{{expense.project.code starts with 'PROJECT-1234-' ? report.account.free_1 : ''}}

Very useful when you want to use some value in SRXP only for the projects of some type. If you have defined your projects systematically, you will be able to do this.


Combines multiple strings or strings with filters in one smartstring

  • ~

{{' '~expense.description~' '~expense.audit_code}}

The ' ', adds a space to the formule


Merge a whole formula to a specific number of characters

{{' '~expense.description~' '~expense.audit_code[0:30]}}


Makes sure that the whole formula will not have more than 30 characters