
\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 = postgetstorage presetstorage
\item infos/status = maintained unittest nodep libc preview
\item infos/metadata = check/condition assign/condition condition/validsuffix
\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*{Testing if Key exists}

{\ttfamily (! a/key)} evaluates to true if the key {\ttfamily a/key} doesn't exist, to false if it exists.

\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.

\subsubsection*{E\+X\+P\+E\+R\+I\+M\+E\+N\+T\+A\+L\+: Nested Conditions}

Multiple conditions can be nested and combined using parentheses and {\ttfamily \&\&} (logical A\+N\+D) or {\ttfamily $\vert$$\vert$} (logical O\+R). Additional parentheses must be used to form valid conditions again. {\ttfamily (} {\ttfamily (condition 1) \&\& (condition 2)} {\ttfamily )}

\subsubsection*{valid suffix}

The {\ttfamily condition/validsuffix} can be used to define a list of valid suffixes to numeric values. If two operants have the same valid suffix or one of them no suffix they will be treated by their numeric value ignoring their suffix. `condition/validsuffix = 'm', 'cm', 'km'{\ttfamily would treat}2.\+3m{\ttfamily just as the numeric value}2.\+3` when comparing to another value having the same or no suffix.

\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}
 