Issue when using Orderby with the option FALSE inside a Start End expression

I'm using the "OrderBy" function to sort the [Fecha] column, highlighted in yellow.  "Fecha" means Date.

maretec_1-1751665760443.png

The date format is day/month/year.

If set to TRUE, it works correctly (descending order).

maretec_5-1751667540640.png

 

But if set to FALSE, all items are in the correct order except the last one.

maretec_4-1751667415907.png

I changed the order from FALSE to TRUE and vice versa several times, but the results were the same.

Any ideas to fix this?

0 8 163
8 REPLIES 8

You may want to check and mention what the outer <<START>> expression that is highlighted in red  in the screenshot below is doing.

Suvrutt_Gurjar_0-1751686612704.png

It sounds that the outer <<START>> expression is populating by claim numbers and the inner <<START>> expression then sorts the children records for that claim by the [Fecha]

The current coded behavior seems to be as expected. When sorted descending , the [Fecha] of the claim "2222" is anyway the smallest in the list. So it is listed at the bottom. However while sorting ascending, first the dates of the claim "1111" are sorted ascending and then the date of claim "2222" comes in the sorting order.

In summary, the current <<START>> expression configuration seems to be such that the records are first sorted by the "claim" number and then within each claim number, those are sorted by the date.

You are right @Suvrutt_Gurjar.  The behavior is correct.

I'm trying to figure out how to do this, but I can't find it. Is it possible?

Could you mention the relationship between the tables involved in the two start expressions?

Also is your requirement to list the records by date ascending irrespective of the claim number?

Each row represents a charge that must be paid. The first column indicates the date of the charge, and the last, the amount due.

It's more important to know the oldest charges that have been paid than the claim number.

maretec_1-1751745476296.png

The "Charge" table (Cargos) is a child table of the Claims table (Reclamos). There is a "Claim ID" column (Reclamo ID) of type Ref, with the Claims table as its source, as shown below. The "is part of " option is selected.

maretec_0-1751745440863.png

 

Could you also mention about the outer <<START>> expression?

It seems to be invoked from another table- May be parent of Claims table?

 

Insurance companies (Aseguradoras) approve work for an auto repair shop to repair those cars. The shop submits a statement to each insurer to collect the charges for each repair.
The expression <<Start:[Aseguradora ID].[Related Reclamos]>> is used to retrieve claims from one of the insurer.
The "Aseguradoras" table only has two columns in Google Sheets: Aseguradora ID (Key) and Aseguradora (the company name).

maretec_2-1751770719310.png

In the Reclamos table (Claims) there is a Ref column pointing to the "Aseguradoras" table (see below).

maretec_0-1751770431065.png

This creates a "Related Reclamos" column in the "Aseguradoras" table.

maretec_1-1751770548459.png

Every time a repair shop needs to enter a claim number (Número de Reclamo), it is linked to an insurance company (Aseguradora).

maretec_3-1751770994877.png

If you need to know anything else, please let me know.

Please try below.

1) In the "Cargos" table, please add a column called say [Insurer_Name] with an expression something like [Reclamo ID].[Insurer_Table_Key]

2) Now the template expressions can be something like below

In the template below,  [Aseguradora Name] is assumed to be the name column of the insurer.

Aseguradora : <<[Aseguradora ID].[Aseguradora Name]>>

Fecha Placa Auto Reclamo other columns Debito

<<Start: ORDERBY(SELECT(Cargos[Cargos Table Key],[Insurer_Name]=[_THISROW].[Aseguradora ID]), [Fecha], FALSE)>>

<<[Fecha]>>

<<[Placa]>> <<[Auto]>> <<[Reclamo ID].[Reclamo Number]>> .........

<<[Monto]>>

<<END>>

 

Edit: Made some changes to make the approach simpler.

Hello @Suvrutt_Gurjar.  I'll do it this week.

Top Labels in this Space