Product search by barcode

What would be the correct way to do a product search by barcode without it being the Product KeyId?
I saw in the Inventory Management App that you use the Bar Code as Product Id. But in my case, there are many products that do not have a bar code.
I can think of 2 options:

  1. Identify the products by their Product ID UNIQUEID (), and make a LOOKUP of the code to locate the Product Id.
  2. Ulitilzar a Computed Key composed of the Product Id and the ScanCode.
    Some other option that I can not think of
0 4 536
4 REPLIES 4

If you have an additional barcode field and you set that field as searchable, it should do the trick if I have understood your requirement correctly.

What I did was this:

IF(ISNOTBLANK([Escanear]),
ANY(SELECT(Productos[Prod Id],[Codรญgo de barras]=[_THISROW].[Escanear])),
IF(AND(ISNOTBLANK([Rubro]),ISNOTBLANK([Producto])),
ANY(SELECT(Productos[Prod Id],AND([Rubro]=[_THISROW].[Rubro],[Producto] = [_THISROW].[Producto],[Variedad]=[_THISROW].[Variedad]))),
โ€œโ€)

)

So if the scan field is not empty look for the result in the Products table and return the Product Id, and if the product is selected manually through the Enum of Item, Product and Variant, look for it and return the Id of Product too.
It seemed the most correct way, do you consider it the best?

Looks good to me, though Iโ€™d use (purely as stylistic preferences) FILTER() instead of SELECT() and IFS() instead of nested IF():

IF(
  ISNOTBLANK([Escanear]),
    ANY(
      FILTER(
        "Productos",
        ([Codรญgo de barras] = [_THISROW].[Escanear])
      )
    ),
  AND(
    ISNOTBLANK([Rubro]),
    ISNOTBLANK([Producto])
  ),
    ANY(
      FILTER(
        "Productos",
        AND(
          ([Rubro] = [_THISROW].[Rubro]),
          ([Producto] = [_THISROW].[Producto]),
          ([Variedad] = [_THISROW].[Variedad])
        )
      )
    )
)

Cool! Thank you so much

Top Labels in this Space