Home > Mobile >  AppScript filter function not working for some values
AppScript filter function not working for some values

Time:10-14

updated: I have a spreadsheet with 3 columns that i am concerned with:

Group (Ferrous/Non-ferrous/etc.) RI No. (Unique identifier) Supplier (Sellers of chosen RI No.) The flow of data happens like this: I select Group (say, Ferrous) --> In RI No. column, an automatic dropdown is created, showing RI Nos. of all items under Ferrous category show up --> I select a particular RI No. from this drop-down --> A drop-down of all sellers selling that item show up. Now, I wrote a code which does this work perfectly, but it is unable make the list of Suppliers when I select an RI No. with a "-" in them. For example, from the RI No. list, if I select a value like "6181-1","Cu-18mm","CU-25x3","25_E.Cont","DOF", the Supplier drop-down list shoes zero options to choose from, even though it is expected to show 2 options for it. This problem does not occur for other values, like "6310-1" or even "TTK1 & TTK2" selected in the RI No. list.

Sample Spreadsheet enter image description here

To this:

enter image description here

And that seems to fix the issue: enter image description here

I'm guessing that the script cannot read the information properly when there are multiple spaces between the rows.

Update:

I modified the code to see the values passed by your filter:

var filteredopts2 = opts2.filter(function(o){return o[6]===firstlevelcolvalue && o[4]===val});

And I noticed that the filter was comparing Non Ferrouse from the JPS tab with Non- Ferrouse in the supplier details tab.

enter image description here

After changing all the values from the supplier details from:

enter image description here

To:

enter image description here

The issue got fixed.

  • Related