Finally my example with different options of bibliography works fine thanks to moewe.
To the below example I needed to add boolean function:
\usepackage{ifthen}
\newboolean{print_or_not}
\setboolean{print_or_not}{true}
%\setboolean{print_or_not}{false}
and at the end of the example I generally (details in the example) added the condition \ifthenelse:
\ifthenelse{\boolean{print_or_not}} { "PRINT ALL BIBLIOGRAPHIES" } { "DON'T PRINTING ADDITIONAL BIBLIOGRAPHIES AT THE END" }
All the example:
\documentclass[10pt,oneside,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ifthen}
\newboolean{print_or_not}
\setboolean{print_or_not}{true}
% \setboolean{print_or_not}{false}
\usepackage[
backend=biber,
bibstyle=authoryear,
citestyle=numeric,
sorting=none,
giveninits=true,
dashed=false,
refsegment=chapter,
backref=true,
]{biblatex}
\makeatletter
\input{numeric.bbx}
\makeatother
\BiblatexSplitbibDefernumbersWarningOff
\DeclareSortingTemplate{none}{
\sort{\field{usera}}
\sort{\citeorder}
\sort{\intciteorder}
}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\pertype{book}
\step[fieldset=usera, fieldvalue=aa]
}
\map{
\pertype{article}
\step[fieldset=usera, fieldvalue=bb]
}
\map{
\pertype{online}
\step[fieldset=usera, fieldvalue=cc]
}
\map{
\pertype{inproceedings}
\step[fieldset=usera, fieldvalue=dd]
}
}
}
\DeclareNameAlias{author}{family-given}
\DeclareNameAlias{translator}{family-given}
\renewcommand*{\revsdnamepunct}{}
\defbibheading{subsubbibintoc}[\refname]{\subsection{#1}}
\defbibheading{subsubbibliography}[\refname]{\subsection{#1}}
\addbibresource{biblatex-examples.bib}
\begin{document}
\pagestyle{empty}
\tableofcontents
\chapter{First chapter}
Lorem \autocite{sigfridsson}
ipsum \autocite{nietzsche:ksa1}
dolor \autocite{moraux}
sit \autocite{knuth:ct:c}~\autocite{spiegelberg}.
\printbibheading[title=Chapter bibliography,heading=subbibintoc]
\printbibliography[segment=\therefsegment,type=book,heading=subsubbibintoc,title={Books}]
\printbibliography[segment=\therefsegment,type=article,heading=subsubbibintoc,title={Articles}]
\printbibliography[segment=\therefsegment,type=online,heading=subsubbibintoc,title={Online}]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subsubbibintoc,title={Conferences}]
\vspace{5mm}
{\let\clearpage\relax \chapter{Second chapter}}
Lorem~\cite{vizedom:related}
ipsum~\cite{gerhardt}
dolor~\cite{augustine}
sit~\cite{ctan}.
\printbibheading[title=Chapter bibliography,heading=subbibintoc]
\printbibliography[segment=\therefsegment,type=book,heading=subsubbibintoc,title={Books}]
\printbibliography[segment=\therefsegment,type=article,heading=subsubbibintoc,title={Articles}]
\printbibliography[segment=\therefsegment,type=online,heading=subsubbibintoc,title={Online}]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subsubbibintoc,title={Conferences}]
\vspace{5mm}
{\let\clearpage\relax \chapter{Third chapter}}
Lorem~\cite{wassenberg},
ipsum~\cite{baez/online}.
% COMENTING \ifthenelse ALL IS CORRECT below
\ifthenelse{\boolean{print_or_not}}
{
% COMENTING above
\printbibheading[title=Chapter bibliography,heading=subbibintoc]
\printbibliography[segment=\therefsegment,type=book,heading=subsubbibintoc,title={Books}]
\printbibliography[segment=\therefsegment,type=article,heading=subsubbibintoc,title={Articles}]
\printbibliography[segment=\therefsegment,type=online,heading=subsubbibintoc,title={Online}]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subsubbibintoc,title={Conferences}]
\printbibheading[title=Global Bibliography,heading=bibintoc]
\printbibliography[type=book,heading=subsubbibliography,title={Books}]
\printbibliography[type=article,heading=subsubbibliography,title={Articles}]
\printbibliography[type=online,heading=subsubbibliography,title={Online}]
\printbibliography[type=inproceedings,heading=subsubbibliography,title={Conferences}]
\csletcs{saved@blx@refcontext@context}{blx@refcontext@context}
\newrefcontext[sorting=nyt]
\makeatletter
\AtNextBibliography{%
\def\blx@setdefaultrefcontext#1{}%
\csletcs{blx@refcontext@context}{saved@blx@refcontext@context}}
\makeatother
\printbibliography[title=Global Bibliography (alphabetic),heading=bibintoc]
\newrefcontext[sorting=nyt]
\makeatletter
\AtNextBibliography{%
\def\blx@setdefaultrefcontext#1{}%
\DeclareFieldFormat{labelnumberwidth}{#1\addperiod}}
\makeatother
\printbibliography[title={Global Bibliography (alphabetic & continuous numbering)},heading=bibintoc]
% COMENTING below
}
{
\printbibheading[title=DON'T PRINT BIBLIOGRAPHY,heading=bibintoc]
}
% COMENTING above
\end{document}
The reason such a decision is simply I need to print an additional global bibliography or not.
The problem is that if part of the code is taken with boolean option like below
\ifthenelse{\boolean{print_or_not}}{}{}
the citation number changes [6] is [8] etc
....like before described in the topic \begingroup \endgroup changing citation numbers. When all example work without boolean option everything is OK!
We can check this problem simply by commenting boolean option in the code or uncomment it. Lines pointed in the code as 104-105 and 138-141.
What is the reason of such the wrong citation with boolean option and whether this can be fixed? It could be the last serious problem of my "episodes of topics".

