I would like to show bibliographies of different categories (e.g., conference papers, journal papers, etc.) in my CV. In each category, the bibliography entries are sorted by the published date. To allow permanent indices for increments in the future, I would have these indices reversely numbered, so that newer works get larger indices. Meanwhile, I would like to mark some of my works as "selected works", in which I set up a new field of "selected" and print the entries using a customized check filter.
I have tried the solution here but it does not work. In my system, the following MWE produces the normal numbering not the reversed.
\documentclass[10pt, a4paper]{article}
\usepackage[czech,english]{babel}
\usepackage[backend=biber,style=ieee,defernumbers=true,sorting=keysort]{biblatex}
\makeatletter
\newcounter{bibenvcounter}
\newcounter{bibitemcounter}[bibenvcounter]
\newcommand*{\auxkacz@envmax}[2]{%
\csgdef{blxkacz@envmax@#1}{#2}}
\defbibenvironment{bibliography}
{\stepcounter{bibenvcounter}%
\list
{\ifcsundef{blxkacz@envmax@\the\value{bibenvcounter}}
{}
{\numdef\abx@field@localnumber{%
\csuse{blxkacz@envmax@\the\value{bibenvcounter}}%
-\value{bibitemcounter}}%
\csundef{blx@defer@\the\c@refsection
@\blx@refcontext@context
@\abx@field@entrykey}%
\blx@thelabelnumber}%
\stepcounter{bibitemcounter}%
\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{labelnumber}}}
{\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}}
{\endlist
\blx@auxwrite@mainaux{}{%
\string\auxkacz@envmax
{\the\value{bibenvcounter}}
{\the\value{bibitemcounter}}}}
{\item}
\makeatother
\defbibcheck{confnoyear}{ \ifentrytype{inproceedings} {\iffieldundef{year}{}{\skipentry}} {\skipentry} }
\defbibcheck{journoyear}{ \ifentrytype{article} {\iffieldundef{year}{}{\skipentry}} {\skipentry} }
\defbibcheck{confwyear}{ \ifentrytype{inproceedings} {\iffieldundef{year}{\skipentry}{}} {\skipentry} }
\defbibcheck{jourwyear}{ \ifentrytype{article} {\iffieldundef{year}{\skipentry}{}} {\skipentry} }
\DeclareSortingScheme{keysort}{
\sort[direction=descending]{\field{entrykey}}
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{a,
author = {Author, A.},
title = {A Title},
date = {1980},
}
@inproceedings{b,
author = {Buthor, B.},
title = {B Title},
date = {1980},
}
@inproceedings{c,
author = {Buthor, C.},
title = {C Title},
date = {1980},
}
@inproceedings{d,
author = {Duthor, D.},
title = {A Title},
}
@inproceedings{e,
author = {Euthor, E.},
title = {B Title},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\newrefcontext[labelprefix=CS,sorting=keysort]
\printbibliography[check=confnoyear] \nocite{*}
\newrefcontext[labelprefix=C,sorting=keysort]
\printbibliography[check=confwyear] \nocite{*}
\end{document}
Is there any problem with my configuration? Any help is appreciated!

.auxfile and find it has already recorded the maximum number of entries of each section, like\abx@aux@refcontext{keysort/global/8D7E99C73CD5A10ADAAF4C9F9A520368/global/global} \auxkacz@envmax{1} {2} \abx@aux@refcontext{keysort/global/0D61F8370CAD1D412F80B84D143E1257/global/global} \auxkacz@envmax{2} {3}. Is there anything wrong in my case? – SXKDZ Dec 09 '21 at 02:23biblatexv3.16, if your system is older it might not work, so please make sure everything is up to date.) – moewe Dec 09 '21 at 05:49