Carbone V4.6.0 - News October 2022
Hello, bonjour, hallo, hola 👋
The Carbone team is pleased to announce: Carbone version 4.6.0
is out 🎉
To empower your creative process, the past weeks were about bringing new tools the Carbone language, make it stronger and steadier. Everything we brought was coming from your voice: new formatters, improvements and fixes!
Update to the latest version
- Carbone Cloud API users: insert the header
"carbone-version":"4"
. Just4
is enough to access the latest version, not4.6.0
. - Carbone Cloud Studio: On the top right of the home page, click on the
settings
button > Click on "Carbone Version" > Select4.x.x
.
What's new ?
🚀 ADDED for PPTX templates:
- Dynamic images are supported. Set the Carbone tag into the image alternative text. It is not possible to create a loop of images.
- All barcodes are supported. Set the Carbone tag into the image alternative text and chain the
:barcode(type)
. To create a QR Code:{d.productCode:barcode(qrcode)}
.
🚀 ADDED - ifTE() formatter
Tests the type of the operand's value, such as: boolean, binary, array, object, number, integer.
Usage: {d.value:ifTE(number):show('It is a number!')}
, meaning the conditional formatter checks if the type of the value is a number.
Learn more on the ifTE documentation
🚀 ADDED - :set() formatter
Store computed values in data with :set(d.newTag)
and print the new placeholder into the template thanks to {d.newTag}
Create any new tag name, and it must be at the root of the dataset, not like d.child.child.value
, only d.
.
The value can be a number, string, list or any types.
It can't be used into aliases.
🚀 ADDED - :diffD() formatter
Compute the difference time between two dates, such as: d.fromDate:diffD(toDate, unit, patternFrom, patternTo).
, details:
fromDate
andtoDate
can be ISO 8601 format or any format defined withpatternFrom
andpatternTo
- unit can be millisecond(s) or ms, second(s) or s, minute(s) or m, hour(s) or h,year(s) or y, month(s) or M, week(s) or w, day(s) or d, quarter(s) or Q.
Here are examples with d.fromDate = 20101001:
{d.fromDate:diffD(20101201, days)}
=> 61
{d.fromDate:diffD(20101201, hours)}
=> 1465
Learn more on [the diffD documentation
](https://carbone.io/documentation.html#diffd-todate-unit-patternfromdate-patterntodate-)
🚀 ADDED - :mod() formatter
Compute modulo! Learn more on [the mod documentation
](https://carbone.io/documentation.html#mod-value-)
⚡️ IMPROVED - performances:
The report build time was reduced by a factor x20 for very big report, before document conversion.
⚡️ IMPROVED - :drop
formatter:
- ODP templates support the drop formatters and all options. A new option
slide
is available to delete slides, usage:{d.value:ifEM:drop(slide)}
. - Multiple paragraphs can be deleted from a single drop expression, pass a number of paragraph to delete as a second argument, such as:
{d.value:ifEM:drop(p, 3)}
meaning, the current and two paragraph bellow are drop if the value if empty.
Learn more on [the drop documentation
](https://carbone.io/documentation.html#drop-element-)
⚡️ IMPROVED - aggregators
- Fixed aggregators
aggSum
,aggAvg
,aggMin
,aggMax
,aggCount
when used with filters (without iterators) like{d.cars[id=1].wheels[size=100].makers[].qty:aggSum}
- Aggregators convert string to floats.
null
orundefined
values are converted toaggSum : 0
,aggMin : +infinity
,aggMax : -infinity
, andaggAvg : 0
⚡️ IMPROVED - Dynamic Parameters
Dynamic parameters passed in formatters with a dot . accepts dynamic array access between brackets [.i]
: It can be used to select the corresponding element of another array: {d.myArray[i]:myFormatter(..otherParentArray[.i].id)}
. [.i]
matches with the index of myArray[i]
. Multiple dots ([..i], [...i])
can be used to access other parents arrays. If the index goes above otherParentArray length, it will return an empty string.
✅ FIXED
- HTML comment tags are not rendered and skipped by
:html
formatter - Barcodes accepts integer values
- Add user-agent
Carbone
when the Cloud API webhook is called. - Docx templates: array filters were ignored when the loop included images (bug introduced in v4.1.0 to fix broken docx)
formatD
ignores the timezone if only a date is parsed without the time (without hour, minute, second)
Get all details with examples on the changelog.
Follow us on twitter or Linkedin to get news and updates.
Cheers 🍻 - David, Guillaume and Steeve
Updated on: 10/21/2022
Thank you!