Hello,
I have a code that works in Zapier, but I’m having trouble getting it to work in Make.com using the “0codekit” module.
My Code:
//Kitchen Countertop Dimensions, Number of Cabinets, Number of Fronts, Number of Shelves
const inputText = inputData['daten'];
const matches = inputText.match(/Length of Kitchen Countertop\s*\d*\s*:\s*(\d+(\.\d+)?)/g);
const result = matches && matches.length > 0 ? {} : "none";
if (matches) {
matches.forEach((match, index) => {
const [, value] = match.split(":").map(s => s.trim());
const numValue = parseFloat(value.replace(",", "."));
result[`Length of Kitchen Countertop ${index + 1}`] = isNaN(numValue) ? value : `${numValue} m | `;
});
}
const korpusRegex = /Cabinets :[\n\s]*- (\d+)/i;
const match = inputText.match(korpusRegex);
const result2 = match ? `${match[1]} pcs.` : "none";
const endText = "Foil for Fronts :";
const outputText = inputText.substring(0, inputText.indexOf(endText))
.replace(/\d+X Shelf/g, "")
.replace(/\[n\]\s*/g, "\n")
.replace(/:.*/g, "")
.replace(/(?:N|U|K|F)\d+/g, "")
.replace(/[^\d\n+X]+/g, " ")
.replace(/\s+/g, function(match, offset, string) {
if (string[offset - 1] === "X") {
return " ";
}
return "+";
})
.replace(/\++/g, "+")
.replace(/^\+|\+$/g, "")
.replace(/X/g, "*");
const result3 = eval(outputText) ? `${eval(outputText)} pcs.` : "none";
const regalMatches = inputText.matchAll(/((\d+)?X\s*)?Shelf/g);
let totalShelves = 0;
for (const regalMatch of regalMatches) {
const multiplier = regalMatch[2] ? parseInt(regalMatch[2], 10) : 1;
totalShelves += isNaN(multiplier) ? 0 : multiplier;
}
............. some more code .......
const plzMatch = inputText2.match(plzRegex);
const cityMatch = inputText2.match(cityRegex);
const addressMatch = inputText2.match(addressRegex);
const infoMatch = inputText2.match(infoRegex);
let outputInfo = {};
if (plzMatch) {
const plz = plzMatch[1].trim();
outputInfo["ZIP Code"] = plz;
}
if (cityMatch) {
const city = cityMatch[1].trim();
outputInfo["City"] = city;
}
if (addressMatch) {
const address = addressMatch[1].trim();
outputInfo["Address"] = address;
}
if (infoMatch) {
const info = infoMatch[1].trim();
outputInfo["Info"] = info;
}
return {
output1: result,
outputCabinets: result2,
outputFronts: result3,
outputShelf: resultShelf,
foilFronts: output1,
foilCabinets: output2,
foilCountertop: output3,
imageUrls: outputObj,
InfoBox: outputInfo
};
Thank you for helping. I want to switch from Zapier to Make.com, but I am encountering issues with some Zaps while trying to integrate it on Make.com. Additionally, I find it frustrating that you can’t simply execute code like in Zapier and instead require an external module, which also comes with additional costs.