In pgfkeys
system, the handler /.try
tries to execute the predefined code. If it fails, i.e. the key is not yet defined, it would act as it does not exists.
On the other hand, if one calls /.retry
right after a /.try
, pgfkeys
would try the former only if the later fails. That is to say, one has a general framework
\pgfkeys{
Did I set this special key?/ ID:289668/ let us/.try,
In case it fails, we still have a fallback/.retry
}
And here is an example

\documentclass[border=9,tikz]{standalone}
\begin{document}
\tikzset{
node content/normal/.code={(\i,\j)},
node content/3/5/.code= \LARGE\color{red} I like this node
}
\tikz[nodes={inner sep=0},scale=3]{
\draw foreach\i in{1,...,10}{
foreach\j in{1,...,10}{
(\i,\j)node[circle,draw,minimum size=rnd*100]{
\tikzset{node content/\i/\j/.try}
\tikzset{node content/normal/.retry}
}
}
};
}
\end{document}
\def\myLabel{thatParticularNode}
would run into problems with expansion... But maybe anxdef
or something could work? – Seamus Jan 27 '16 at 13:03/.try
handler. It is like "so let's try if someone set the content for this node before." – Symbol 1 Jan 27 '16 at 14:06foreach \i/\j in {<node id or coordinate>/<node content>, .... }
. – Zarko Jan 27 '16 at 14:07