
\begin{DoxyItemize}
\item infos = Information about the conditionals plugin is in keys below
\item infos/author = Thomas Waser \href{mailto:thomas.waser@libelektra.org}{\tt thomas.\+waser@libelektra.\+org}
\item infos/licence = B\+S\+D
\item infos/provides =
\item infos/needs =
\item infos/recommends =
\item infos/placements = presetstorage
\item infos/status = maintained unittest nodep libc preview
\item infos/metadata = check/condition assign/condition
\item infos/description =
\end{DoxyItemize}

This plugin uses if-\/then-\/else like conditions.

\subsection*{Check Syntax}

Stored in the metakey {\ttfamily check/condition} to validate data is\+:

{\ttfamily (I\+F-\/condition) ? (T\+H\+E\+N-\/condition) \+: (E\+L\+S\+E-\/condition)} where the E\+L\+S\+E-\/condition is optional

Condition\+: {\ttfamily Key} {\itshape Operation} `('String' $\vert$ '1234.\+56' $\vert$ Key $\vert$ '')`

Operations\+: {\ttfamily !=, ==, $<$, $<$=, =$>$, $>$, \+:=}, where\+:


\begin{DoxyItemize}
\item {\ttfamily \+:=} is used to set a key value
\item others are for comparison as in C
\end{DoxyItemize}

\subsubsection*{Assign Syntax}

`(I\+F-\/condition) ? ('Then\+Value') \+: ('Else\+Value')`

Depending on if the condition is met, either 'Then\+Value' or 'Else\+Value' will be assigned as key value if the metakey {\ttfamily assign/condition} is used.

\subsection*{Example}

`(this/key != 'value') ? (then/key == some/other/key) \+: (or/key $<$= '125')`

Meaning\+: I\+F {\ttfamily this/key} N\+O\+T E\+Q\+U\+A\+L T\+O {\ttfamily 'value'} T\+H\+E\+N {\ttfamily then/key} M\+U\+S\+T E\+Q\+U\+A\+L {\ttfamily some/other/key} E\+L\+S\+E {\ttfamily or/key} M\+U\+S\+T B\+E L\+E\+S\+S T\+H\+A\+N {\ttfamily 125}

Another full example\+: \begin{DoxyVerb}    kdb mount conditionals.dump /tmount/conditionals conditionals dump
    kdb set user/tmount/conditionals/fkey 3.0
    kdb set user/tmount/conditionals/hkey hello
    kdb setmeta user/tmount/conditionals/key check/condition "(hkey == 'hello') ? (fkey == '3.0')" # success
    kdb setmeta user/tmount/conditionals/key check/condition "(hkey == 'hello') ? (fkey == '5.0')" # fail
\end{DoxyVerb}


Assignment example\+: \begin{DoxyVerb}    kdb mount conditionals.dump /tmount/conditionals conditionals dump
    kdb set user/tmount/conditionals/hkey Hello
    kdb setmeta user/tmount/conditionals/hkey assign/condition "(hkey == 'Hello') ? ('World')"
    kdb get user/tmount/conditionals/hkey # output: World\end{DoxyVerb}
 