Hello,
I could not find any documentation for the If
function, other than this post from Gregori:
Type detection in ‘if’ statement - Issues - Community (datagrok.ai)
Could you please point me at the documentation, in case I missed it?
By experimenting with the function I could figure out that nested If
s are supported; however, it seems that a function is not accepted as the result of the If
clause evaluation. See the two examples below.
Example that works
I can create 3 calculated columns as follows:
-
ModelPlusMinus
:RegExpExtract (${Idea Tags}, "Model[+-]+", 0)
-
DockPlusMinus
:RegExpExtract (${Idea Tags}, "Dock[+-]+", 0)
-
DockPlusMinusNA
:if (IsNotEmpty(${ModelPlusMinus}), ${ModelPlusMinus}, if (IsNotEmpty(${DockPlusMinus}), ${DockPlusMinus}, "n.a."))
As expected, column DockPlusMinusNA
contains Model+
, Model-
, Model+-
, Dock+
, Dock-
, Dock+-
, n.a.
depending on the content of the intermediate columns ModelPlusMinus
and DockPlusMinus
.
Example that does not work
I cannot create a calculated column without using any intermediate columns with the following expression:
if (RegExpContains (${Idea Tags}, "Model[+-]+"), RegExpExtract (${Idea Tags}, "Model[+-]+", 0), if (RegExpContains (${Idea Tags}, "Dock+"), RegExpExtract (${Idea Tags}, "Dock[+-]+", 0), "n.a."))
Could you please confirm if the above is expected?
If so, it would be great if the If
clause evaluation could support functions as the result, in addition to string constants or column titles, as it would remove the need to create intermediate columns.
Thanks in advance, kind regards
Paolo