Smart String - Advanced scenarios

Scenario 1 - Report Level

So let's say if you only want to use the 'report submitter's account free field 1' if and only if the payment method code is equal to ABCD. You can now do this, let's build it!!

Use the 'report submitter's user free field 1' if and only if the payment method code is                                    equal to ABCD. Otherwise, the export

First, select the *SmartString* from the dropdown in the export format settings.

Note: Make sure to select it on expense level, because our example will need to 'look' at the payment method of an expense.

      Remember we (SRXP) make a clear distinction between report and expense fields,                                selecting any expense field in an expense level dropdown will not work.

So, if the payment method code is ABCD, we want to export the free field 1 of the user's account that submitted the report.

Familiar yourself first with the structure of an if statement:


The test-statement looks like: A operator B

So something like this works: amount.category.code == 'ABCD'. Look at the Section 'The list of test operators' further down on this documentation page to see examples and explanation about the different supported operators used in if statements.

Back to the example!

For this we will need to see what A and B is, A = expense payment method code, B = 'ABCD'

To know how we get A we can scroll down on this documentation page to Section 'All fields'. To get the payment method of the expense we start with A = expense. Then, we follow the structure of the expense and look for the field 'payment_method'. We can expand A now so we get, A = expense.payment_method. We are not done yet, because want the code to be exported.  

We follow the structure of the payment_method field now and see that is has a couple of values:


  • .code
  • .free_1
  • .name
  • .type

We select the code now, and so we get

                      A = expense.payment_method.code B = 'ABCD'

Note: The ABCD is encapsulated in ticks ' ', the reason for this is that we want to compare non-numeric values, so called 'Strings' of simply 'Text'. Any numeric values can be compared without the ticks. So if A would be an amount, we would be comparing numeric values, we would not add ticks and can simply do this A > 1000

The submitter of the report is bound to the report resource, so we start with A = report we look at the account that is linked to the report, now we have A = report.account and then target free field 1, so report.account.free_1


Note: The output values should be encapsulated in two curly brackets, closing an opening . Everything not within brackets will be output as is. In the example above, SRXP- will prefix the report id.