Skip to content

source.getColCount

Use when: You want to read values from the original incoming message before any mapping changes. If you need the modified message during mapping, use message.getColCount.

Signature: source.getColCount()

Returns: Integer count - the number of columns in a source

Get the number of columns in a source.

Note

This method only applies to CSV formatted messages.

Parameters

None

Example

// Given a CSV source with a header row.
/* source:
'Name,Age,Location\n' +
'John,30,NY\n' +
'Alice,25,LA'
*/

// Retrieve the number of columns in the CSV message.
var colCount = source.getColCount(); // expected: 3