Como hacer que cambie de status mi columna automaticamente por medio de la fecha

QUERIA VER SI ME PUEDEN AYUDAR QUE MI COLUMNA โ€œSTATUSโ€ CAMBIE DE ACTIVO A INACTIVO AUTOMATICAMENTE, LA COLUMNA STATUS ESTA EN LA TABLA DE CLIENTES, PERO QUIERO QUE CAMBIE SI EL ULTIMO PAGO REALIZADO ES MENOR QUE 60 DIAS QUE LA FECHA ACTUAL


LA COLUMNA PAGOS REALIZADOS HACE REFERENCIA ALA TABLA PAGOS

Solved Solved
0 5 220
1 ACCEPTED SOLUTION

Please try below

Create a VC called say [Status] in the Clientes table with an expression something like

IF(INDEX(SORT([PAGOS REALIZADOS][FECHA], TRUE),1)<TODAY()-60,โ€œInactiveโ€, โ€œActiveโ€)

The highlighted part may need change based on what exactly you are looking for as condition for โ€œActiveโ€ and โ€œInactiveโ€ you have described is not exactly clear.

[PAGOS REALIZADOS] is assumed to be the name of the reverse reference column in the Clientes table.

Edit: If you are looking for updating a real column in the Clientes table, you could use reference action to update the Clientes table whenever a new row is added to the child table Pagos.

The below sample app demonstrates updating child record based on parent record update through reference actions. You could use a reverse flow.

https://www.appsheet.com/templates/This-app-shows-how-to-use-reference-actions?appGuidString=e76d2e7...

View solution in original post

5 REPLIES 5

Please try below

Create a VC called say [Status] in the Clientes table with an expression something like

IF(INDEX(SORT([PAGOS REALIZADOS][FECHA], TRUE),1)<TODAY()-60,โ€œInactiveโ€, โ€œActiveโ€)

The highlighted part may need change based on what exactly you are looking for as condition for โ€œActiveโ€ and โ€œInactiveโ€ you have described is not exactly clear.

[PAGOS REALIZADOS] is assumed to be the name of the reverse reference column in the Clientes table.

Edit: If you are looking for updating a real column in the Clientes table, you could use reference action to update the Clientes table whenever a new row is added to the child table Pagos.

The below sample app demonstrates updating child record based on parent record update through reference actions. You could use a reverse flow.

https://www.appsheet.com/templates/This-app-shows-how-to-use-reference-actions?appGuidString=e76d2e7...

YA CREE LA COLUMNA VIRTUAL CON EL NOMBRE DE โ€œSTATUS 2โ€ PERO SOLO SE ACTUALIZA CON LOS 2 PRIMEROS MOVIMIENTOS DE LA COLUMNA โ€œPAGOS REALIZADOSโ€ COMO PUEDO HACER PARA QUE SOLO TOME COMO REFERENCIA EL ULTIMO MOVIMIENTO


It is not exactly clear what you are looking for. Principally the left side expression is correct to give you either the latest or oldest date from the child table (if you reverse the order of SORT() with TRUE or FALSE). Thereafter you need to use a proper comparison for that date with the aging part < TODAY()-60 depending on your need.

Unfortunately, it is not clear which date or date range you wish to make it active or inactive.

Also in your shared picture of child table records, all records are showing active. So not clear what condition you are looking for deciding active /inactive.

You may please give that requirement detail in a simple table such as below?

3X_4_3_436abe0df06124e789681f6d8e53019076b7185b.png

AQUI HICE OTRO MOVIMIENTO CON UNA FECHA MUY ANTERIOR PARA VER SI SE CAMBIABA A INACTIVO

PERO YA NO SE CAMBIO , SE SUPONE QUE EL STATUS SE VA CAMBIAR CONFORME LA FECHA DEL ULTIMO MOVIMIENTO , ESOS MOVIMIENTO SOLO LOS HICE DE PRUEBA PARA VER SI SE CAMBIABA CONFORME LA ULTIMO MOVIMIENTO

Okay , now it is more clear, eventhough the conditional requirement for active , inactive of 60 days is still unclear.

Does your table have a datetimestamp column for the record update? If not you may need to use the row number to get the date of the latest update.

Please create a virtual column in the parent table Clientes called say [Latest Payment] with an expression such as
MAXROW(โ€œPAGOSโ€, โ€œ_ROWNUMBERโ€, [Codigo]=[_THISROW].[Codigo])

In the [Status ] VC, then you may have the below expression such as

IF(DATE([Last Update].[Fecha])<TODAY()-60, โ€œInactiveโ€, โ€œActiveโ€)

Edit: Added the word virtual at highlighted place.

Top Labels in this Space