Hoping for someone to tell me what I am doing wrong - using Pabbly Code action with Javascript to pass arrays to Documentero for document generation.
Have tried everything I can think of, googled endlessly, no matter what i try, when the output generates, all the items in the Array still contain " around the text.
For example, the line of code is:
let IncomeDesc= IncomeText.replace(/[\[\]]/g, '').split(',');
The output from the Pabbly Code action is:
[{"IncomeDescription":"\"Income\"","IncomeOwner":"\"Jess Harris\"","IncomeAmount":"$443","IncomeFrequency":"\"Fortnightly\"","AnnualIncome":"$11,518"},{"IncomeDescription":"\"Income 1\"","IncomeOwner":"\"Shane Harris\"","IncomeAmount":"$100","IncomeFrequency":"\"Weekly\"","AnnualIncome":"$5,200"},{"IncomeDescription":"\"Income joint\"","IncomeOwner":"\"Shane Harris","IncomeAmount":"$100","IncomeFrequency":"\"Yearly\"","AnnualIncome":"$100"}]
This comes out into the end documents as:
Interestingly, the only outputs that are not wrapped in " are currency outputs that have been handled through the following internal function:
const formatCurrency = (number, symbol = '$') => {
const formattedNumber = number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return `${symbol}${formattedNumber}`;
};
Have tried to use the replace info from this without luck (I am not great with regex at all, but feel like i should be able to figure this out)
Have tried everything I can think of, googled endlessly, no matter what i try, when the output generates, all the items in the Array still contain " around the text.
For example, the line of code is:
let IncomeDesc= IncomeText.replace(/[\[\]]/g, '').split(',');
The output from the Pabbly Code action is:
[{"IncomeDescription":"\"Income\"","IncomeOwner":"\"Jess Harris\"","IncomeAmount":"$443","IncomeFrequency":"\"Fortnightly\"","AnnualIncome":"$11,518"},{"IncomeDescription":"\"Income 1\"","IncomeOwner":"\"Shane Harris\"","IncomeAmount":"$100","IncomeFrequency":"\"Weekly\"","AnnualIncome":"$5,200"},{"IncomeDescription":"\"Income joint\"","IncomeOwner":"\"Shane Harris","IncomeAmount":"$100","IncomeFrequency":"\"Yearly\"","AnnualIncome":"$100"}]
This comes out into the end documents as:
"Income" | "Jess Harris" | $443 | "Fortnightly" | $11,518 |
Interestingly, the only outputs that are not wrapped in " are currency outputs that have been handled through the following internal function:
const formatCurrency = (number, symbol = '$') => {
const formattedNumber = number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
return `${symbol}${formattedNumber}`;
};
Have tried to use the replace info from this without luck (I am not great with regex at all, but feel like i should be able to figure this out)