Aaron McCausland
12/13/2024, 11:30 PMCan't compare values of these types. Allowed comparisons are between two numbers, two strings, two dates, or two booleans.
Left hand operand is a hash+string (wrapper: com.netledger.templates.model.StringModel).
Right hand operand is a number (wrapper: f.t.SimpleNumber).
The blamed expression:
==> record.internalid == 12345 [in template "template" at line 203, column 22]
Celigo AI
12/13/2024, 11:31 PMAI generated answer (using internal Slack threads):In the FreeMarker source code of Advanced PDF/HTML templates, you can reference the internal ID of the transaction record to be rendered using
${record.internalid}
. However, the error you're encountering is due to the fact that you're trying to compare a string (the internal ID) with a number.
In FreeMarker, you can't directly compare a string with a number. You need to convert the string to a number first. You can do this using the ?number
built-in function in FreeMarker.
Here's how you can do it:
<#if record.internalid?number == 12345>
This will convert the internal ID to a number before comparing it with 12345.
Please note that this will only work if the internal ID is a numeric string. If it contains any non-numeric characters, you'll get an error. In that case, you might need to use a different approach, such as comparing the internal ID with a string:
<#if record.internalid == "12345">
This will compare the internal ID with the string "12345", which should work regardless of whether the internal ID is a numeric string or not.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
12/13/2024, 11:31 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.826732
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825768769
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825088859
Celigo AI
12/13/2024, 11:31 PM