Question
Please tell me how to determine if a string is the last one in a column?
Answer
You need to use the select function to get the id of the last row by order: 'order_field' desc
, which you need, and if it matches the id of the current row, then this row is the last one.
Example of string formatting code:
f1=: setRowFormat(condition: $last_id = #id; background: "whitesmoke")
last_id: if(condition: $@last_id = ""; then: $create_proc_var; else: $@last_id)
create_proc_var: procVar(name: "last_id"; value: $select)
select: select(table: $#ntn; field: 'id'; order: 'id' desc)
In this code, a process variable is used to get the id of the last row only once during the table loading process. The row formatting code will be executed for each row displayed on the page, but the database query to get the last row number will only be executed for the first row, and then it will be stored in the process variable until the query execution is completed.