I'm using next macro in web part visible field
{% CMSContext.Current.GlobalObjects.Users.Where("UserID="+ToInt(QueryString["UserId"], 0 )).FirstItem.IsExpertIn != "" #%}
but it doesn't work if IsExpertIn returns null.
How i need to modify my macro to handle situation when IsExpertIn returns null?
Hi Vasyl,
I think if IsExpertIn is string value, you should use:
{% !string.IsNullOrEmpty(CMSContext.Current.GlobalObjects.Users.Where("UserID="+ToInt(QueryString["UserId"], 0 )).FirstItem.IsExpertIn) |(identity)GlobalAdministrator%}
Following code covers both null and empty string values:
{% GlobalObjects.Users.Where("UserID="+ToInt(QueryString.GetValue("UserId"),0)).FirstItem.IsExpertIn.ToString()!="" |(identity)GlobalAdministrator%}
Please, sign in to be able to submit a new answer.