jo-cpa
October 29, 2021, 7:29pm
1
I have a table with a column that has three possible @domains.org listed.
I would like to replace the value with another.
e.g. @domainABC.org - value to be “TECH - ABC”
I would like to do this because an API that I use is expecting the body JSON to have the value in this format.
Is this substitution/replacement of the value possible in the Parameters code of the JSON for the API?
Hey @jo-cpa , if I understood correctly, you need to transform your data with something like the following
{{
Table1.data.map(row => {
row.domainColumn = row.domainColumn
.replace(/@domainABC\.org/g, "TECH-ABC")
.replace(/@domainXYZ\.org/g, "TECH-XYZ");
return row;
})
}}
Is this what you’re looking for?
jo-cpa
November 1, 2021, 5:12pm
3
Hmm. I’m having some issue.
I get…
TypeError: Cannot read properties of undefined (reading ‘map’) with this
{{
students_tbl.data.map(row => {
row.student_school_email = row.student_school_email
.replace(/@cpa.org /g, “TECH CPA”)
.replace(/@mva.org /g, “TECH MVA”);
return row;
})
}}
Hey @jo-cpa , sorry about this, looks like it’s actually tableData
, not data
. That’ll teach me not to rely on my memory too much! Here’s the updated code block from my previous post:
{{
Table1.tableData.map(row => {
row.domainColumn = row.domainColumn
.replace(/@domainABC\.org/g, "TECH-ABC")
.replace(/@domainXYZ\.org/g, "TECH-XYZ");
return row;
})
}}