API: Report exporter billable and reimbursable values always blank?

Hi,
I'm trying to get the billable
and reimbursable
expense values through the csv report exporter but they always output blank in the exported csv. All of the other report and expense values in my template are coming through correctly (e.g. amount
, tag
, comment
), so I'm not sure what the issue is.
Any guidance on how to properly get these values is appreciated.
Thanks
Best Answer
-
Hi @John_!
For reference, the reimbursable and billable variables are booleans. As such, these won't output any values without a string added to them.
Using the billable variable as an example, instead of using
${expense.billable}
, try using${expense.billable?string("Yes", "No"}
. This will outputYes
if the expense is billable andNo
if it is not.Let me know if that does the trick for you!
Answers
-
Thanks for the link, but I think the documentation may only be relevant for the built-in exporter on the site?
Sorry I wasn't very specific, but I'm using the api to generate the csv and am following the documentation here: https://integrations.expensify.com/Integration-Server/doc/#report-exporter and here: https://integrations.expensify.com/Integration-Server/doc/export_report_template.html
Here's a snippet of the export report template I'm using:
<#list reports as report> <#list report.transactionList as expense> ${report.reportID},<#t> ${report.reportName},<#t> ${report.status},<#t> ${report.created},<#t> ${report.submitted},<#t> ${report.accountID},<#t> ${report.accountEmail},<#t> ${expense.transactionID},<#t> ${expense.merchant},<#t> ${expense.amount},<#t> ${expense.modifiedAmount},<#t> ${expense.category},<#t> ${expense.tag},<#t> ${expense.created},<#t> ${expense.inserted},<#t> ${expense.comment},<#t> ${expense.billable}<#lt> </#list> </#list>
With this template, all of the requested report and expense variables are present in the generated csv, except for
expense.billable
which exports empty no matter what the real value is. This led me to try exporting the other booleanexpense.reimbursable
and I discovered that it also exports blank as well. -
Yep that does the trick!
Thanks, Greg!
-
Sure thing! Have yourself a solid rest of the week @John_.
-
I just came here with the same question about the API. The API docs (https://integrations.expensify.com/Integration-Server/doc/export_report_template.html) are not at all clear about how to get boolean fields to return any data.
Thanks for answering the question here, but I highly recommend that you update the API docs somehow so that people don't have to find this thread to learn how to get data from a boolean field.
-
I concur with @maasj ! Please update your docs on retrieving booleans, this is not intuitive.
I also request updating docs on why another field might be blank. Example, for some reason all of my imports had a blank "amount" field when pulling from the expense line item. You docs say that field should be filled, though it gives info on convertedAmount, etc... That hack worked, but I didn't think I was going to need it as all I needed was the original amount (which was blank).
-
I am also getting an error:
"Could not process template"When using the "string" built-in.
Changing it to ?c gives me what I am looking for.
On another note, looking into this more, it appears that there is an expectation that we've been using Freemarker. I've never used it until now, and the Freemarker API is a ton to read when I just need a list of expenses dumped into CSV format. I would recommend assuming that the API developers have never used Freemarker and have been asked to just get a dump of expenses from your API.
It would be most appreciated if the documents had the minimum needed from Freemarker to extract the data we need, then, for those wanting to explore more, give them a few hints as to what are some cool things you can do with Freemarker or something.
Thanks