Setting a col value with a condition

hello everyone, i need a little help with this expression, let me context my problem, i have a table that register dispatch requests from users, that requests are classified by types ( [Tipo_despacho] ) when the order has been dispatched i use this expresion to change the status of the order

if(
in([_thisrow].[Tipo_despacho], 
  	select(despacho[tipo_despacho],[ID_Benef]=[_THISROW].[ID_Benef]))=true,
"Despachado", "Pendiente")

well that works fine but i have 1 category in [Tipo_despacho], that repeats some times, and when an user creates another request for the same [ID_Benef] the expression result as true and change the status cause there are older request with the same [Tipo_despacho] in it, there is any way to filter the older orders only for that particular type of [Tipo_despacho] ?

in the picture its an example, those two orders where created for today and both have the same type, there is another order from a month ago that have that type too for that [ID_Benef] , so when they were created my expression set them to โ€œDespachadoโ€ instead of โ€œPendienteโ€.

0 2 111
2 REPLIES 2

Without knowing the exact table definitions you have, it seems like you need to have a reference field other than [ID_Benef] - most likely the key of requests table - in despacho back to the dispatch request table.

That way, you can easily create an expression to check if a corresponding record exists in despacho to change the status of the request to "Despachado".

To me, your expression doesn't require =true

if(
   in([_thisrow].[Tipo_despacho],
      select(despacho[tipo_despacho],[ID_Benef]=[_THISROW].[ID_Benef]))=true,
"Despachado", "Pendiente")

Top Labels in this Space