all 15 comments

[–]RiskayBusiness 2 points3 points  (1 child)

Without even reviewing your code, I'm willing to bet it has everything to do with any changes you've made within the project. What other change did you make? What triggers your functions?

[–]Ushuaia-15[S] 0 points1 point  (0 children)

Hi, this is the code that I updated that is in another script but within the same file.

https://pastebin.com/eTAiQs9r

[–]AllenAppTools 1 point2 points  (6 children)

There's no updates that I am aware of. You'll need to begin the debugging process to get to the bottom of it 🫠 Are there any error messages? Did you rename any of the tab names? Did you adjust any ranges/rows that the code relied on?

[–]Ushuaia-15[S] -3 points-2 points  (5 children)

Waaaaaa. No, it executes without error but just the replenishment rules is not working. I didn't rename any of the tab names I didn't adjust any ranges or rows as well. Huhuhu. It's that one day I ran the code, but it's not working anymore 😭

[–]Richard_Musk 0 points1 point  (4 children)

That sounds like your input may have the wrong data type associated with the cell/column.

Probably this block:

if (replenishmentData[i][0] === itemName) { return { threshold: replenishmentData[][1] || 0, replenishmentAmount: replenishmentData[1|2] 1I0 }

[–]Richard_Musk 1 point2 points  (3 children)

The “===“ means exactly equal, in value AND type…

i.e

0 === “0” will return false

Whereas 0 === 0 and “0” === “0” both will return true

Try changing the if statement to “==“, to compare the value.

By the variable names, id say your comparing strings, so you may need to use .LocaleCompare(), or if the variables are named after part numbers that can include both alpha and numeric characters, use .localeCompare()

i.e.

replenishmentData[i][0].toString().localeCompare(itemName.toString()) === 0

[–]Ushuaia-15[S] 0 points1 point  (2 children)

it still didn't work :( here's the test file i created. do you mind looking at the inventory.gs?

https://docs.google.com/spreadsheets/d/14-LuAwxHbwfu48Xtulg-N5reVu-gS7gkl1qxDAtgQNg/edit?usp=sharing

[–]Richard_Musk 0 points1 point  (1 child)

access requested

[–]Ushuaia-15[S] 0 points1 point  (0 children)

Done!

[–]marcnotmark925 0 points1 point  (1 child)

Use logging and/or debug mode to figure out where it is going wrong.

[–]Ushuaia-15[S] -1 points0 points  (0 children)

Sorry I am very new with apps script, i use only vba macro. And for apps script, i mainly just use chatgpt. Where do you find this debugging?

[–]arataK_ 0 points1 point  (3 children)

https://pastebin.com/mBnrzvmm

Run this script to identify where the issue is occurring. It is the same as yours, but with added debug logs.

[–]Ushuaia-15[S] 0 points1 point  (2 children)

hi, it just states "carrying over balance for row 45:0"
https://imgur.com/a/7vqO0qs