"cannot compare list with text in" in slices

Good evening everyone,

I need assistance with this matter, and i havenยดt found someone with the same error as myself among the existing treads.
I want to filter the data of my app based on user roles as described on this tutorial

Ever since i have done everything as the tutorial says but, i ran into a error in when i try to filter the data in the security field, using a slice, as shown in the images:



And this is the error i get:

Iโ€™ve been frustrated with this error for a while now and i canโ€™t find where iโ€™m wrong

Solved Solved
0 16 1,110
1 ACCEPTED SOLUTION

Thank you @Steve and @SkrOYC, i made it work with this expression with the help of you both

OR(
IN(โ€œAdminโ€, user[ROL]),
AND(
IN(โ€œUsuarioโ€, user[ROL]),
ANY(user[Lugar])=[Lugar]
)
)

View solution in original post

16 REPLIES 16

Steve
Platinum 4
Platinum 4

What is the column type for the LUGAR column of the Inventario table?

El filtro es para definir cuรกles filas mostrar. Para ello se debe indicar una expresiรณn que cada fila va a evaluar y asรญ definir si ser incluida o no.
Por favor indicarnos quรฉ columnas tiene la tabla โ€œInventarioโ€ y quรฉ filas necesitas filtrar de dicha tabla en base a los usuarios.
Puedes describirlo en palabras y harรฉ lo que pueda para entenderte, pero necesitamos primero una foto de la tabla que te indiquรฉ.
Por otro lado, si en lugar de filtrar algunas filas necesitas ocultar la tabla por completo dependiendo el rol, eso se hace en la vista bajo el apartado UX e indicar Show_If
Si tu objetivo es que se cambien los permisos de ediciรณn, eso se hace en la vista bajo el apartado Data โ€œAre updates allowed?โ€
Quedo atento!

Sรญ, el filtro es para que los usuarios vean solo los datos asociados a su LUGAR, en este caso si en la tabla Empleados estรกn dados de alta en el LUGAR de Peรฑasquito, solo deben ver los datos de Agua y Emulsiรณn Asfรกltica pertenecientes a peรฑasquito:

Pero si es un administrador, pueda ver todo.
Gracias por el apoyo!

Notado.
Tu fรณrmula estรก correcta, excepto que escribiste โ€œAddminโ€ en lugar de โ€œAdminโ€.
Te recomiendo cambiar la columna Lugar a โ€œEnumโ€ y asรญ controlas con opciones quรฉ lugares estรกn disponibles para cada usuario, incluso permitir agregar alguno.

Gracias por notar esa d de mรกs, pero ya lo he escrito varias veces y aun asรญ no funciona
No se a que se deba.

This is the columns from the table Inventario

Try this as your security filter:

OR(
  IN("Addmin", user[ROL]),
  AND(
    IN("Usuario", user[ROL]),
    IN([LUGAR], user[LUGAR])
  )
)

Thank you! it does works for โ€œAdminโ€ now, but it can not filter the data for โ€œUsuarioโ€ now.
Admin:

Usuario:

Try this instead:

OR(
  IN("Admin", user[ROL]),
  IN("Usuario", user[ROL])
)

What about the place?? They need to filter the data also taking into account wich place is allowed for a certain worker. I have to admit Iโ€™m a little bit lost

Debugging. Test the individual parts. We know the Admin test works, so try adding just the Usuario test.

IFS(
  INDEX(User[ROL],1)="Admin", true,
    AND(
      INDEX(User[ROL],1)="Usuario",
      INDEX(User[LUGAR],1)=[LUGAR]
    ), true
)

Me marco el mismo error que con el IFS, como que especรญficamente esa expresiรณn no la acepta.

Favor envรญanos una imรกgen de las columnas que componen la tabla Empleados mostrando los tipo de columna

Claro, asรญ se compone la tabla Empleados.

Thank you @Steve and @SkrOYC, i made it work with this expression with the help of you both

OR(
IN(โ€œAdminโ€, user[ROL]),
AND(
IN(โ€œUsuarioโ€, user[ROL]),
ANY(user[Lugar])=[Lugar]
)
)

Top Labels in this Space