In XPath 1.0, is there a way to test the existence of the evaluated expression and modify the result on its behalf?
I am trying to implement this pseudo-code:
if ID is empty
then 0 + 1
else ID + 1
Actual code, so far:
xdMath:Eval(xdMath:Max(
xdXDocument:GetDOM("FetchID")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:ID),
'concat("(ID = ", (d:ID or 0) + 1,")")'
)
This expression doesn't work when there is no item in the list, hence max(d:ID)
is empty.
There's usually an ugly workaround, something like
concat("0", ID) + 1