Sayyed Ziya
Sayyed Ziya

Reputation: 1

NetSuite - Saved Search formula for calculating percentage from summary Total

I would like to create a Saved Search in NetSuite that returns the percentage of Quotation in a specific month. I have achieved month wise count of quotation and in summary total is also showing as a year, I want to calculate monthly percentage based yearly total in another column. enter image description here enter image description here

Upvotes: 0

Views: 1057

Answers (1)

Nathan Sutherland
Nathan Sutherland

Reputation: 1270

I'm afraid the only way to do this is Client side.

if (!window.hereFirst) {
    window.hereFirst = true;
    window.addEventListener(`load`, (e) => {
        let rcs = Array.from(document.querySelectorAll(`[row-count]`));
        let tc = rcs.reduce((t, r) => t + Number(r.getAttribute(`row-count`)), 0);
        rcs.forEach(r => {
            let rp = r.parentElement;
            rp.textContent = ((Number(r.getAttribute(`row-count`)) / tc) * 100)
                .toFixed(1) + `%`;
            rp.classList.add(`listtextrt`);
        });
    });
}

this goes into an html image onload event. NetSuite Column Definitions and produces NetSuite Client Side Results

Minimum of Formula (Text):

'<img style="display: none;" row-count="'||COUNT(DISTINCT {number})||'" src="/core/media/media.nl?id=#&c=#&h=..." onload="if (!window.hereFirst) { window.hereFirst = true; window.addEventListener(`load`,(e) => { let rcs = Array.from(document.querySelectorAll(`[row-count]`)); let tc = rcs.reduce((t,r) => t+Number(r.getAttribute(`row-count`)),0); rcs.forEach(r => { let rp = r.parentElement; rp.textContent = ((Number(r.getAttribute(`row-count`))/tc)*100).toFixed(1)+`%`; rp.classList.add(`listtextrt`); }); }); }">'

I use my company's logo for the image since the browser is already loading and caching it.

Upvotes: 0

Related Questions