Javascript output not showing in the frontend

Hi,

I have the following codes which gives the correct result in the backend javascript:

const sets = p3.split(“\”).map(set => set.split(“|”).map(item => item.trim()));
let targetSet = null;
const falseSets = ;

// Identify the target set and collect FALSE sets
for (const set of sets) {
if (set[0] === p2) {
targetSet = set;
} else if (set.length > 2) {
falseSets.push(set);
}
}

// Return empty string if target set is not found
if (!targetSet) return “”;

// Extract target properties
const targetDateRange = targetSet[2], targetEquipment = targetSet[3];
if (!targetDateRange || !targetEquipment) return “”;

// Parse date range
const [targetStart, targetEnd] = targetDateRange.split(" - “).map(Date.parse);
const targetEquipmentSet = new Set(targetEquipment.split(”\n").map(item => item.trim()));

// Object to store conflicting equipment and owners
const conflictingItems = {};

// Process false sets
for (const set of falseSets) {
const setDateRange = set[2], setEquipment = set[3], setOwner = set[4];
if (!setDateRange || !setEquipment) continue;

// Parse date range
const [setStart, setEnd] = setDateRange.split(" - ").map(Date.parse);

// Skip non-overlapping date ranges
if (targetEnd <= setStart || targetStart >= setEnd) continue;

// Check for conflicts using Set for efficiency
for (const item of setEquipment.split(“\n”)) {
const trimmedItem = item.trim();
if (targetEquipmentSet.has(trimmedItem)) conflictingItems[trimmedItem] = setOwner;
}
}

// Generate output
return […targetEquipmentSet].map(item => conflictingItems[item] ? ${item} with ${conflictingItems[item]} : item).join(“\n”);

The above looks for conflicting booked equipments with overlapping dates.

However, the result is not showing in the frontend. I tried optimizing the codes but still the result is not showing in the frontend. Anyone able to advise how to overcome this problem?

Thanks in advanced,

Clement

So can you confirm that your end result is a string, and you can’t find a way to display that string on the front end?

1/What component were you using to display it in the front end?
2/Are you using Glide Tables, Glide Big Tables or something else?
3/Do you have row owners enabled for the relevant tables?