Numeric or text prymary key for rank formula works

When I use one numeric prymary key, id_cc (number), for each cittie from my citties table (CCs table), the rank formula fails for certain rows.
.
But, otherwise, if I use an text prymary key, like city name, the rank formula works nice, but my app stops to saving any changes.
(I edited the city names and removed all the accents).
.
It seems to be a bug. Help me with sugestions please.

Solved Solved
0 11 128
1 ACCEPTED SOLUTION

Dear Jaichit, I really appreciate your help, it was important for me to move forward with my application. Using the Cidade_UFC column as key the app is now working fine. I consider the problem solved. Thanks

View solution in original post

11 REPLIES 11

Please share screenshots of data, table structure etc. 

Share the rank expression. And where are you applying it. 

Print screen CCs table.  Column 1: Cidade_UFC is the text key; column 2: id_cc_num is the numeric key (number). 

CCs-Table.jpg

CCs_Tab view print screen. vRank is the rank calculation result and it's correct, using Cidade_UFC as the text key.

WhatsApp Image 2024-05-13 at 07.42.13.jpeg

The CCs table, slice CCs_slc, virtual column vRank formula:

count(
split(
left(
orderby(
CCs_slc[Cidade_UFC],[SomaTop],true
),
find(
[_THISROW].[Cidade_UFC],
orderby(
CCs_slc[Cidade_UFC],[SomaTop],true
)
)
),
" , "
)
) - 1

(COUNT( ....SPLIT( ........LEFT( ............ORDERBY( ................CCs_slc[Cidade_UFC] ................The value of column 'SomaTop' ................"true") ............FIND( ................The value of 'Cidade_UFC' from the row referenced by 'Cidade_UFC' ................ORDERBY( ....................CCs_slc[Cidade_UFC] ....................The value of column 'SomaTop' ...................."true"))) ........" , ")) - 1)

Do you have 2 keys in the table ?

No, I use one only each time, or Cidade_UFC, or id_cc_num. Now I am using only Cidade_UFC (text). And the rank calculation is doing correct.

If I would use the other column, id_cc_num as a key, it will be necessary to change the table definitions in my app and in the database definition as a label and as key. And will be necessary also change the vRank, formula replacing the key name from Cidade_UFC to id_cc_num. 

The AppSheet database has a criterion for handling name accentuation that is different from that used by the table within the application. I removed, 3 days ago, all the accents from the city names from the Cidade_UFC key. This may even be why the application is now saving all the data I changed. 

This difference in criteria affects the result of sorting Cidade_UFC in the table within the database, and the result using Cidade_UFC in sorting a view

I have checked your expressions. I have small confusion in the last part of expression "-1" . 

Can you please share the correct calculations and wrong calculations. 

Logically speaking there is no logical error in expression. 

Will deep into it.

The wrong calculation: Ok, I changed the key, I now used the id_cc_num column as the key. As you can see, the city Araucaria, the last one in the view below, should have received a vRank of 18, but received an incorrect rank of 4.

.

count(
split(
left(
orderby(
CCs_slc[id_cc_num],[SomaTop],true
),
find(
[_THISROW].[id_cc_num],
orderby(
CCs_slc[id_cc_num],[SomaTop],true
)
)
),
" , "
)
) - 1

 

WhatsApp Image 2024-05-13 at 11.58.03.jpeg

Using the column Cidade_UFC as a key, was a correct calculation, that I already sent to you before. 

Dear Jaichit, I really appreciate your help, it was important for me to move forward with my application. Using the Cidade_UFC column as key the app is now working fine. I consider the problem solved. Thanks

Top Labels in this Space