NexarDeveloper / nexar-supply-excel-cs

The Nexar Supply Excel Add-in
MIT License
18 stars 0 forks source link

BAU-208: Allow distributor(s) to be specified by Id as well as partial name #25

Closed RobAltium closed 1 year ago

RobAltium commented 1 year ago

This fix is in support of ticket 1028.

The current pull request makes the following changes:

  1. It allows users to specify either a Seller ID or a (partially matched) company name in functions which filter distributors.
  2. A tip is added to the README file.
  3. The add-in version is bumped to v0.5.2.

@RowMur or @MeEntity: Please can one of you review these code changes?

With these changes, for example, you can specify 2454 instead of Future Electronics.

The particular issue addressed by these changes is a specific case where the user would use 1532 for distributor TME because otherwise the partial name matching behaviour means TME would match Utmel.

Whilst we could perform an exact match first then a partial match if no exact match is found, that isn't quite right. It would mean second-guessing what the user wants: with TME would they prefer a Utmel offer if that's the only one, or is it is better to return offer not found? This solution avoids that uncertainty: if you specify the company ID you are being explicit.

RobAltium commented 1 year ago

This is obviously a good change. Adding this has no drawback, as it removes any ambiguity for customers when they input an ID. However, thinking about it in practice, how would a customer get these IDs for their functions?

As per the README they would refer to the list here: https://octopart.com/api/v4/values#sellers

If they have a large BOM, with lots of rows, they aren't going to want to manually change the function for each row. They could have a key that they look up in Excel to map a name to a ID but that feels a bit clunky.

The power of Excel can help here. I imagine a lot of customers would have BOMs in which there is a row for distributor. And some will also have preferred distributors which can be placed manually in specific cells to be referenced in the functions.

Would it be sensible to have a distributor ID query in the add-in?

That's a good suggestion. Feel free to put another BAU ticket for this and chat to Phil. I see two functions here potentially, something like: =NEXAR_SUPPLY_DISTRIBUTOR(name_or_id) <- Returns the full name of the distributor to be used. =NEXAR_SUPPLY_DISTRIBUTOR_ID(name) <- Returns the ID of the first seller found from the input name. We'd have to think through the best behaviour when there is more than one match from the given input.